Licenses extension
From Meta
This extension allows to license every article in mediawiki (you can see how mediawiki commons do with the files).
[edit] version 1.6.8
The only thing that you have to change on this version is the /includes/EditPage.php file.
You have to add this lines:
- Line 17 (at the top of the file)
require_once 'Licenses.php';
- Line 38 (after
var $autoSumm = '';
)
var $mLicense= ;
- Line 349 (after
$this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 );
)
$this->mLicense = $request->getVal ('wpLicense');
- Line 407 (after
$this->textbox2 = '';
)
$this->mLicense = '';
- Line 572 (after
if ( ( '' == $this->textbox1 ) ) {
$wgOut->redirect( $this->mTitle->getFullURL() ); wfProfileOut( $fname ); return false;
}
$license= $this->mLicense;
echo "Licencia1: ".$license;
$licensetxt = "\n== " . wfMsgForContent( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";
$isComment=($this->section=='new');
$this->mArticle->insertNewArticle( $this->textbox1.$licensetxt, $this->summary,
$this->minoredit, $this->watchthis, false, $isComment);
- Line 1051 after (<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" );)
$licenses = new Licenses();
$license = wfMsgHtml( 'license' );
$nolicense = wfMsgHtml( 'nolicense' );
$licenseshtml = $licenses->getHtml();
if ( $licenseshtml != '' ) {
global $wgStylePath;
$wgOut->addHTML( "<center>
<td align='right'><label for='wpLicense'>$license:</label></td>
<td align='left'>
<script type='text/javascript' src=\"$wgStylePath/common/upload.js\"></script>
<select name='wpLicense' id='wpLicense' tabindex='4'
onchange='licenseSelectorCheck()'>
<option value=''>$nolicense</option>
$licenseshtml
</select>
</td></center><br>
");
}
[edit] Version 1.4.7
Todos los cambios hacen referencia a la versión de mediawiki 1.4.7 base.
Nota: Monitorización de cambios realizada con la herramienta diff de linux (diff -I RE Origen Origen). Su significado es:
- > añadir una línea
- < borrar una línea
- 293c294,295 línea en el fichero original c linea en el fichero modificado, linea donde finaliza la modificacion
[edit] Cambios en includes/Article.php
34a35
> var $mLicId;
45a47
>
172d173
<
293c294,295
< 'cur_comment','cur_counter','cur_restrictions','cur_touched' );
---
> 'cur_comment','cur_counter','cur_restrictions','cur_touched',
> 'cur_lic_id' );
352,353d353
<
< if ( $this->mContentLoaded ) return;
354a355
> if ( $this->mContentLoaded ) return;
518a520
>
565c567,586
<
---
> /**
> * Return the Article license
> */
> function getLicId() {
> $fname = 'Article::getLicId';
> if ($id = $this->getID() ) {
> $dbr =& $this->getDB();
> return $dbr->selectField('cur', 'cur_lic_id',
> array('cur_id' => $id),
> $fname, array());
> } else {
> return 0;
> }
> if( $this->mTitle ) {
> return $this->mTitle->getArticleLicId();
> } else {
> return 0;
> }
> }
>
703d723
<
823a844,897
>
> #Cambio *******************************************************************************************
> $resultado=$this->getLicId();
> if (0==$resultado)
> {
> $resultado=5;
> }
>
> //consulta para el nombre de la licencia
> $dbr =& wfGetDB( DB_SLAVE );
> $sql2 = "SELECT lic_name FROM license WHERE lic_id = ".$resultado;
>
> $res1 = $dbr->query( $sql2, "Article::view" );
> if ( 0 == $dbr->numRows( $res1 ) ) {
> //echo "ERROR, NO HAY LICENCIA PARA ESE IDENTIFICADOR article.php linea 851";
> //echo mysql_result($res1,0,0);
> //die;
> }
>
> if (!(0 == $dbr->numRows( $res1 ) )) {
> $Licencia=mysql_result($res1,0,0);
> } else {
> $SinLicencia=1;
> }
>
> //consulta para el enlace
> $sql3 = "SELECT lic_link FROM license WHERE lic_id = ".$resultado;
> $res2 = $dbr->query( $sql3, "Article::view" );
>
> if (!( 0 == $dbr->numRows( $res2 ) )) {
> $Enlace=mysql_result($res2,0,0);
> } else {
> $Enlace="NO HAY ENLACE PARA ESA LICENCIA";
> }
>
> //consulta para la descripción
> $sql4 = "SELECT lic_description FROM license WHERE lic_id = ".$resultado;
> $res3 = $dbr->query( $sql4, "Article::view" );
>
> if (!( 0 == $dbr->numRows( $res3 ) )) {
> $descripcion=mysql_result($res3,0,0);
> } else {
> $descripcion="No hay descripción";
> }
>
> //if (!$SinLicencia){
> $prueba="<table align=\"center\" border=0 cellpadding=0 style=\"width:100%;\"><tr ><td width=\"100%\" style=\"font-size:small;text-align:center;color:white;background-color:grey\"><p title=\"$descripcion\">La licencia de este artÃculo es: <b><a href=\"$Enlace\" target=\"_blank\">$Licencia</a></b ></td ></tr ><p> </table>";
> //}
> $wgOut->addHTML( $prueba );
>
> //consulta para los metadatos y RDF
>
> //Título del artículo
> $titulo=$this->mTitle->getDBkey();
824a899,955
> //Para el autor
> $sql5 = "SELECT cur_user_text FROM cur WHERE cur_title = \"$titulo\"";
> $res4 = $dbr->query( $sql5, "Article::view" );
> if (!(0 == $dbr->numRows( $res4 ) ))
> {
> $usuario=mysql_result($res4,0,0);
> }else{
> $usuario="Anonimo";
> }
>
> //para la descripcción
>
> $sql6 = "SELECT cur_comment FROM cur WHERE cur_title = \"$titulo\"";
> $res5 = $dbr->query( $sql6, "Article::view" );
>
> $resultado=@mysql_result($res5,0,0);
> if ( 0 == $dbr->numRows( $res5 ) )
> {
> $descripcion="Artículo perteneciente a la Commonpedia y a su autor. No tiene descripción";
> }else{
> $descripcion="Artículo perteneciente a la Commonpedia y a su autor. ".$resultado;
> }
>
> //para los metadatos de la licencia
> $sql7 = "SELECT lic_rdf FROM license WHERE lic_id = ".$this->getLicId();
> $res6 = $dbr->query( $sql7, "Article::view" );
>
> if (!( 0 == $dbr->numRows( $res6 ) )) {
> $Rdf=mysql_result($res6,0,0);
> if (!(empty($Rdf))) {
> $Rdf=$Rdf."<rdf:Description>
> <dc:title>$titulo</dc:title>
> <dc:creator>Usuario de Comonpedia de la Universidad de Extremadura: $usuario</dc:creator>
> <dc:description>$descripcion</dc:description>
> </rdf:Description>";
> $Rdf=$Rdf."</rdf:RDF> --><hr>";
>
> } else {
> $Rdf= " <meta name=\"DC.Title\" content=\" Commonpedia de la Universidad de Extremadura \">
> <meta name=\"DC.Creator\" content=\"Grupo MediaWiki, Secretariado Nuevas Tecnologías de la UNEX\">
> <meta name=\"DC.Subject\" content=\"Metadatos\">
> <meta name=\"DC.Description\" content=\"Página perteneciente a Commonpedia, diccionario de la Universidad de Extremadura\">
> <meta name=\"DC.Publisher\" content=\"Secretariado de Nuevas Tecnologías de la Universidad de Extremadura\">
> <meta name=\"DC.Date\" content=\"2005-09-01\">
> <meta name=\"DC.Type\" scheme=\"DCMIType\" content=\"Text\">
> <meta name=\"DC.Format.Medium\" content=\"text/html\">
> <meta name=\"DC.Relation.isPartOf\" content=\"http://reduex.unex.es/commonpedia/\">
> <meta name=\"DC.Identifier\" content=\"http://reduex.unex.es/commonpedia/\">
> <meta name=\"DC.Language\" content=\"es\">
> <meta name=\"DC.Rights\" content=\"CC-GPL 2005 by Universidad de Extremadura\"><hr>";
> }
>
> }
> $wgOut->addHTML( $Rdf );
>
> #CAMBIO *******************************************************************************************
>
842c973
< function insertNewArticle( $text, $summary, $isminor, $watchthis ) {
---
> function insertNewArticle( $text, $summary, $isminor, $watchthis, $lic_id ) {
883a1015
> 'cur_lic_id' => $lic_id,
1011c1143
< function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
---
> function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '',$lic='' ) {
1018c1150
<
---
> echo "principio";
1048c1180
<
---
> echo "hola uno";
1055,1056c1187,1189
<
< # First update the cur row
---
> #Cambios
> if (!(empty($lic))){
> # First update the cur row Con licencia
1068c1201,1202
< 'inverse_timestamp' => $won
---
> 'inverse_timestamp' => $won,
> 'cur_lic_id'=> $lic
1074c1208,1228
<
---
> }else{ //actualizamos sin licencia
> # First update the cur row
> $dbw->update( 'cur',
> array( /* SET */
> 'cur_text' => $text,
> 'cur_comment' => $summary,
> 'cur_minor_edit' => $me2,
> 'cur_user' => $wgUser->getID(),
> 'cur_timestamp' => $dbw->timestamp($now),
> 'cur_user_text' => $wgUser->getName(),
> 'cur_is_redirect' => $redir,
> 'cur_is_new' => 0,
> 'cur_touched' => $dbw->timestamp($now),
> 'inverse_timestamp' => $won,
> ), array( /* WHERE */
> 'cur_id' => $this->getID(),
> 'cur_timestamp' => $dbw->timestamp($this->getTimestamp())
> ), $fname
> );
> }
> #Cambios
1144d1297
<
1168c1321
<
---
>
1182a1336
>
1735a1890,1893
> $curLicId = $dbw->selectField( 'cur', 'cur_lic_id', array(
> 'cur_namespace' => $ns,
> 'cur_title' => $t,
> ), $fname, array());
1747a1906
> 'ar_lic_id' => 'cur_lic_id',
1779a1939
> 'ar_lic_id' => $curLicId,
2328a2489
>
[edit] Cambios en includes/EditPage.php
26d25
< var $lic_id = ''; //******************* Cambios
92,96c91
<
< //******************* Cambios
< $this->lic_id = trim( $request->getText( 'wpLicId' ) );
< //******************* Cambios
<
---
>
131d125
< $this->lic_id = ''; //******************* Cambios
184a179,181
> if(!$this->mTitle->getArticleID()) { # new article
> $wgOut->addWikiText(wfmsg('newarticletext'));
> }
230c227
< } //******************* Cambios
---
> }
232c229
< &$this->summary, &$this->minoredit, &$this->watchthis, &$this->lic_id, NULL)))
---
> &$this->summary, &$this->minoredit, &$this->watchthis, NULL)))
235c232
< $this->minoredit, $this->watchthis , $this->lic_id);
---
> $this->minoredit, $this->watchthis );
238c235
< $this->watchthis, $this->lic_id, NULL));
---
> $this->watchthis, NULL));
241c238
< }//******************* Cambios
---
> }
305c302
< $this->watchthis, '', $sectionanchor))
---
> $this->watchthis, '', $sectionanchor ))
323d319
< $this->lic_id = $this->mArticle->getLicId(); //******************* Cambios
535,607d530
< //******************* Cambios
< $wgOut->addHTML( "{$toolbar}");
< $wgOut->addHTML( "<form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"
< enctype=\"multipart/form-data\">");
< require_once( "LicenseList.php" );
< # Obtain list of available licenses.
< $licenseList = new LicenseList();
< if(!$this->mTitle->getArticleID()
< && !$wgTitle->getNamespace()) { # new article
< $wgOut->addWikiText(wfmsg('newarticletext'));
< $wgOut->addHTML( "
< <div><label>".wfMsg('selectlicensefornewfile')."<select name=\"wpLicId\">");
<
< $licIdOptions='';
< $user=$wgUser->getID();
< foreach ( $licenseList->mList as $index => $license ) {
< if ($license->lic_nd &! $user) continue;
< $Licencia=$wgUser->getLicense(); //Cogemos la licencia del usuario por defecto
< if (($Licencia>8)||($Licencia<1)) {$Licencia=5;}
< $selected = ($index == $Licencia) ? 'selected="selected"' : '';
< $licIdOptions .= "<option value=\"{$index}\" {$selected}>{$license->lic_name}</option>";
< }
< $wgOut->addHTML( "{$licIdOptions}</select></label>".'<a href="http://158.49.122.28/moodle/mod/resource/view.php?id=2058" TARGET="_blank">Información sobre las Licencias</a>'."</div>");
< } else {
< if (!$this->lic_id) {
< # Default value if it has no license.
< $this->lic_id= 5;
<
< #Aquí hay que permitir cambiar la licencias
< $aux=$this->mArticle->getTitle(); //sacamos el título
<
< if ($wgUser->getName() == $aux->getDBkey()) { //sólo si es el propietario
<
< $wgOut->addHTML( "<form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"
< enctype=\"multipart/form-data\">");
< require_once( "LicenseList.php" );
< # Obtain list of available licenses.
< $licenseList = new LicenseList();
< $wgOut->addHTML( "
< <div><label>".wfMsg('selectlicensefornewfile')."<select name=\"wpLicId\">");
<
< $licIdOptions='';
< $user=$wgUser->getID();
< foreach ( $licenseList->mList as $index => $license ) {
< if ($license->lic_nd &! $user) continue;
< $Licencia=$wgUser->getLicense();
< if (($Licencia>8)||($Licencia<1)) {$Licencia=5;}
< $selected = ($index == $Licencia) ? 'selected="selected"' : '';
< $licIdOptions .= "<option value=\"{$index}\" {$selected}>{$license->lic_name}</option>";
< }
< $wgOut->addHTML( "{$licIdOptions}</select></label>".'<a href="http://158.49.122.28/moodle/mod/resource/view.php?id=2058" TARGET="_blank">Información sobre las Licencias</a>'."</div>");
<
< //fin de poder cambiar las licencias
<
< }
< }
< $licenseNd = $licenseList->mList[$this->lic_id]->lic_nd;
< # Don't allow editing of Nd articles except by owner.
< if($this->mTitle
< && $licenseNd
< && $wgUser->getID() != $this->mArticle->getUser()) {
< if (!(($wgUser->isSysop())||($wgUser->isBureaucrat()))) //cambios
< {
< $wgOut->ownerRequired();
< return;
< }
< }
< $licenseName = $licenseList->mList[$this->lic_id]->lic_name;
< $wgOut->addHTML("<br>Obra está publicada bajo los términos de la licencia:<b> {$licenseName}</b>\n".'<a href="http://158.49.122.28/moodle/mod/resource/view.php?id=2058" TARGET="_blank"> Información sobre las Licencias</a>');
<
< }
< //******************* Cambios
<
608a532,534
> {$toolbar}
> <form id=\"editform\" name=\"editform\" method=\"post\" action=\"$action\"
> enctype=\"multipart/form-data\">
[edit] Crear nuevo fichero fuente includes/LicenseList.php
<?php
/**
* @package MediaWiki
*/
class LicenseList {
/**#@+
* @access private
*/
var $mList = array();
function LicenseList() {
$fname = 'LicenseList::LicenseList';
$dbr =& wfGetDB( DB_SLAVE );
$res = $dbr->select( 'license', array('lic_id', 'lic_name','lic_description','lic_link'), '', $fname );
while ( $row = $dbr->fetchObject ( $res ) ) {
$this->mList[$row->lic_id] = $row;
}
$dbr->freeResult ($res);
}
}
?>
[edit] Cambios en includes/SpecialUndelete.php
154c154
< $sql = "SELECT ar_text,ar_comment,ar_user,ar_user_text,ar_timestamp,ar_minor_edit,ar_flags FROM $archive WHERE ar_namespace={$namespace} AND ar_title='{$t}' ";
---
> $sql = "SELECT ar_text,ar_comment,ar_user,ar_user_text,ar_timestamp,ar_minor_edit,ar_flags,ar_lic_id FROM $archive WHERE ar_namespace={$namespace} AND ar_title='{$t}' ";
184a185
> 'cur_lic_id' => $s->ar_lic_id,
[edit] Cambios en languages/LanguageEs.php
307,309d306 < "yourdni" =>"Tu Documento Nacional de Identidad", < "realname" =>"Tu nombre real", < "selectuserdefaultlicense" => "Elija la licencia para publicar sus artÃculos ", #cambios 361,362d357 < "ownertext" => "Este artÃculo sólo puede ser editado por su propietario", < "ownertitle" => "Contenido sin obras derivadas (ND), no puede ser editado por usted", 1153,1157d1147 < // Cambios < 'selectlicensefornewarticle' => "Elija la licencia para este nuevo artÃculo", < 'selectlicensefornewfile' => "Elija la licencia para este nuevo fichero: ", < 'selectdfaultlicense' => "Elija su licencia por defecto: ", < #Cambios
[edit] Cambios en includes/Image.php
31,32c31
< $attributesLoaded,
< $imageLicense; #Cambios
---
> $attributesLoaded;
34a34,35
>
>
137d137
< 'imageLicense'=>$this->imageLicense, #Cambio
782c782
< function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source = "",$imageLicense )
---
> function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source = "" )
810c810
<
---
>
814,816d813
<
< if (!$imageLicense) $imageLicense =0; #cambios
<
825,827d821
< #Cambio
< 'im_lic_id' => $imageLicense,
< #Cambio
838,844c832
<
< /**************************************************************************/
< /*Cambios: debemos establecer una licencia para la imagen antes de subirla*/
< /**************************************************************************/
< echo "La licencia del artículo es: ".$imageLicense;
< $article->insertNewArticle( $textdesc, $desc, false, false, $imageLicense );
<
---
> $article->insertNewArticle( $textdesc, $desc, false, false );
850,852c838
< 'img_user','img_user_text','im_lic_id' ), array( 'img_name' => $name ), $fname, 'FOR UPDATE' );
<
<
---
> 'img_user','img_user_text' ), array( 'img_name' => $name ), $fname, 'FOR UPDATE' );
863,864c849
< 'oi_user_text' => $s->img_user_text,
< 'oi_lic_id' => $s->im_lic_id
---
> 'oi_user_text' => $s->img_user_text
867,875c852
<
< #Cambios
<
< if ($imageLicense==0)
< {
< $imageLicense=$s->im_lic_id;
< }
< #Cambios
<
---
>
884d860
< 'im_lic_id' => $imageLicense, #Cambios
[edit] Cambios en includes/ImagePage.php
110,216d109
<
< #CAMBIO
<
< if (!($this->img->imageLicense))
< {
<
< global $wgUser, $wgOut;
<
< $dbr =& wfGetDB( DB_SLAVE );
< $sql = "SELECT im_lic_id FROM image WHERE img_name = \"".$this->img->getName()."\"";
< $res = $dbr->query( $sql, "ImagePage::openShowImage" );
< $this->img->imageLicense = mysql_result($res,0,0);
< if ( 0 == $dbr->numRows( $res ) ) {
< echo "ERROR, NO EXISTE LICENCIA PARA LA IMAGEN";
< die;
< }
< }
< $sql2 = "SELECT lic_name FROM license WHERE lic_id = ".$this->img->imageLicense;
< $res1 = $dbr->query( $sql2, "ImagePage::openShowImage" );
< if ( 0 == $dbr->numRows( $res1 ) ) {
< echo "ERROR, NO HAY LICENCIA PARA ESE IDENTIFICADOR, imagepage.php linea 130";
< die;
< }
< $Licencia=mysql_result($res1,0,0);
<
< //consulta para el enlace
< $sql3 = "SELECT lic_link FROM license WHERE lic_id = ".$this->img->imageLicense;
< //echo $sql3;
<
< $res2 = $dbr->query( $sql3, "Article::view" );
< if ( 0 == $dbr->numRows( $res2 ) ) {
< echo "ERROR, NO HAY ENLACE PARA ESE IDENTIFICADOR imagepage.php linea 140";
< echo "<br>Identificador: $Licencia";
< echo mysql_result($res2,0,0);
< die;
< }
<
< $Enlace=mysql_result($res2,0,0);
<
< //consulta para la descripción
< $sql4 = "SELECT lic_description FROM license WHERE lic_id = ".$this->img->imageLicense;
< $res3 = $dbr->query( $sql4, "Article::view" );
<
< if (!( 0 == $dbr->numRows( $res3 ) )) {
< $descripcion=mysql_result($res3,0,0);
< } else {
< $descripcion="No hay descripción";
< }
<
< $prueba="<table align=\"center\" border=0 cellpadding=0 style=\"width:100%;\"><tr ><td width=\"100%\" style=\"font-size:small;text-align:center;color:brown;background-color:orange\"><p title=\"$descripcion\">La licencia de este Fichero es: <b><a href=\"$Enlace\" target=\"_blank\">$Licencia</a></b ></td ></tr ><p> </table>";
<
< $wgOut->addHTML( $prueba );
<
< //consulta para los metadatos y RDF
<
< //Título de la imagen
< $titulo=$this->mTitle->getDBkey();;
<
< //autor
< $sql6 = "SELECT img_user_text FROM image WHERE img_name = \"".$this->img->getName()."\"";
< $res5 = $dbr->query( $sql6, "Article::view" );
<
< $autor=mysql_result($res5,0,0);
<
< // Descripcción de la imagen
<
< $sql7 = "SELECT img_description FROM image WHERE img_name = \"".$this->img->getName()."\"";
< $res6 = $dbr->query( $sql7, "Article::view" );
< $descripcion=mysql_result($res6,0,0);
<
< $descripcion="Fichero perteneciente a la Commonpedia y a su autor. ".$descripcion;
<
<
< $sql5 = "SELECT lic_rdf FROM license WHERE lic_id = ".$this->img->imageLicense;
< $res4 = $dbr->query( $sql5, "Article::view" );
<
<
< if (!( 0 == $dbr->numRows( $res4 ) )) {
< $Rdf=mysql_result($res4,0,0);
< if (!(empty($Rdf))) {
< $Rdf=$Rdf."<rdf:Description>
< <dc:title>$titulo</dc:title>
< <dc:creator>$autor</dc:creator>
< <dc:description>$descripcion</dc:description>
< </rdf:Description>";
< $Rdf=$Rdf."</rdf:RDF> --><hr>";
<
< } else {
< $Rdf= " <meta name=\"DC.Title\" content=\" Commonpedia de la Universidad de Extremadura \">
< <meta name=\"DC.Creator\" content=\"Grupo MediaWiki, Secretariado Nuevas Tecnologías de la UNEX\">
< <meta name=\"DC.Subject\" content=\"Metadatos\">
< <meta name=\"DC.Description\" content=\"Página perteneciente a Commonpedia, diccionario de la Universidad de Extremadura\">
< <meta name=\"DC.Publisher\" content=\"Secretariado de Nuevas Tecnologías de la Universidad de Extremadura\">
< <meta name=\"DC.Date\" content=\"2005-09-01\">
< <meta name=\"DC.Type\" scheme=\"DCMIType\" content=\"Text\">
< <meta name=\"DC.Format.Medium\" content=\"text/html\">
< <meta name=\"DC.Relation.isPartOf\" content=\"http://reduex.unex.es/commonpedia/\">
< <meta name=\"DC.Identifier\" content=\"http://reduex.unex.es/commonpedia/\">
< <meta name=\"DC.Language\" content=\"es\">
< <meta name=\"DC.Rights\" content=\"CC-GPL 2005 by Universidad de Extremadura\"><hr>";
< }
< }
<
< $wgOut->addHTML( $Rdf );
<
< #CAMBIO
<
522,530c415
<
<
< #Cambio
< $licencia = $dbr->selectField( 'oldimage', 'oi_lic_id','oi_archive_name=\'' .
< $dbr->strencode( $oldimage ) . "'" );
<
< wfRecordUpload( $name, $oldver, $size, wfMsg( "reverted" ),"","",$licencia);
< #Cambio
<
---
> wfRecordUpload( $name, $oldver, $size, wfMsg( "reverted" ) );
[edit] Cambios en includes/OutputPage.php
593,610d592
<
< function ownerRequired($returnto='') {
< global $wgUser, $wgRequest;
<
< $this->setPageTitle( wfMsg( 'ownertitle' ) );
< $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
< $this->setRobotpolicy( 'noindex,nofollow' );
< $this->setArticleRelated( false );
< $this->mBodytext = '';
<
< $sk = $wgUser->getSkin();
< $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' );
< $this->addHTML( wfMsg( 'ownertext', $ap ) );
< if (!$returnto) {
< $returnto = $wgRequest->getText( 'title' );
< }
< $this->returnToMain(false, $returnto);
< }
[edit] Cambios en includes/SpecialPreferences.php
35c35
< var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize, $defaultLicense;
---
> var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
66,67c66
< $this->defaultLicense = $request->getVal( 'wpLicId' ); //Cambio ************************+
<
---
>
75d73
<
212d209
< $wgUser->setLicense($this->defaultLicense); #Cambio *****************************************
270,271d266
< $this->defaultLicense = $wgUser->getLicense(); #Cambio **************************************
<
478,502d472
<
< #Cambios **************************************************************************
<
< $wgOut->addHTML( "<br>" );
< require_once( "LicenseList.php" );
< # Obtain list of available licenses.
< $licenseList = new LicenseList();
< $wgOut->addHTML( "
< <div><label>".wfMsg('selectdfaultlicense')."<select name=\"wpLicId\">");
<
< $licIdOptions='';
< $user=$wgUser->getID();
< foreach ( $licenseList->mList as $index => $license ) {
< if ($license->lic_nd &! $user) continue;
< $Licencia=$wgUser->getLicense();
< if (($Licencia>8)||($Licencia<1)) {$Licencia=5;}
< $selected = ($index == $Licencia) ? 'selected="selected"' : '';
< $licIdOptions .= "<option value=\"{$index}\" {$selected}>{$license->lic_name}</option>";
< }
< $wgOut->addHTML( "{$licIdOptions}</select></label>".'<a href="http://158.49.122.28/moodle/mod/resource/view.php?id=2058" TARGET="_blank">Información sobre las Licencias</a>'."</div>");
<
<
< #Cambios **************************************************************************
<
<
643,644d612
<
<
[edit] Cambios en includes/SpecialUpload.php
34c34
< var $mOname, $mSessionKey, $mLicenseImg,$mLicense; //******************* Cambios
---
> var $mOname, $mSessionKey;
43d42
<
58,63d56
< #Cambios
< $this->mLicenseImg = $request->getText( 'wpLicId' );#cambios (del select del primer formulario)
< $mLicense=$this->mLicenseImg;
< $_SESSION["mLicense"]=$mLicense;
< #Cambios
<
64a58
>
78,81c72
< $this->mLicense = $data['mLicense']; #Cambio
<
<
< } else {
---
> } else {
88,93d78
<
< #Cambios
< $this->mLicense = $_SESSION["mLicense"];
< $this->mLicenseImg = $_SESSION["mLicense"];
< #Cambios
<
144,145c129,130
<
< /**
---
>
> /**
280d264
<
286,289c270
< $this->mUploadSource,
< #Cambios
< $this->mLicense);
< #Cambios
---
> $this->mUploadSource );
392,393c373
< 'mOname' => $this->mOname,
< 'mLicense' => $this->mLicense); #Cambio
---
> 'mOname' => $this->mOname );
484d463
< <input type=hidden name=\"wpLicense\" value=\"" . htmlspecialchars( $this->mLicense ) . "\" />
550a530
>
565,593c545,546
< <tr><td></td><td align='left'>");
<
< #***********
< #Cambiossss
< #***********
< require_once( "LicenseList.php" );
< # Obtain list of available licenses.
< $licenseList = new LicenseList();
< $wgOut->addHTML( "<div><label>".wfMsg('selectlicensefornewfile')
< ."<select name=\"wpLicId\">");
< $licIdOptions='';
< $user=$wgUser->getID();
< foreach ( $licenseList->mList as $index => $license ) {
< if ($license->lic_nd &! $user) continue;
< $selected = ($index == $this->mLicId) ? 'selected="selected"' : '';
< $licIdOptions .= "<option value=\"{$index}\" {$selected}>{$license->lic_name}</option>\n";
< }
< $wgOut->addHTML( "{$licIdOptions}</select></label>".'<a href="http://158.49.122.28/moodle/mod/resource/view.php?id=2058" TARGET="_blank"> Información sobre las Licencias</a></div>');
< if (!$this->lic_id) {
< # Default value if it has no license.
< $this->lic_id= 1;
< }
< $licenseNd = $licenseList->mList[$this->lic_id]->lic_nd;
<
< #***********
< #Cambiossss
< #***********
<
< $wgOut->addHTML( "<input tabindex='5' type='submit' name=\"wpUpload\" value=\"{$ulb}\" />
---
> <tr><td></td><td align='left'>
> <input tabindex='5' type='submit' name=\"wpUpload\" value=\"{$ulb}\" />
595d547
<
[edit] Cambios en includes/SpecialUserlogin.php
35c35 < var $mLoginattempt, $mRemember, $mEmail, $mLicId; --- > var $mLoginattempt, $mRemember, $mEmail; 54d53 < $this->mLicId = $request->getVal( 'wpLicId' ); //Cambio licencias 56d54 < 233d230 < $u->setLicense($this->mLicId);
[edit] Cambios en includes/templates/Userlogin.php
70,100d69
<
<
< <!--Cambio -->
< </tr>
< <tr>
< <td align='right'><label for='wpDNI'><?php $this->msg('yourdni') ?>:</label></td>
< <td align='left'>
< <input tabindex='7' type='text' name="wpDNI" id="wpDNI"
< value="<?php $this->text('email') ?>" size='20' />
< </td>
<
< <tr>
< <td colspan=2>
< <?
< require_once( "LicenseList.php" );
< # Obtain list of available licenses.
< $licenseList = new LicenseList();
< echo "<div><label>".wfMsg('selectuserdefaultlicense')."<select name=\"wpLicId\">";
< $licIdOptions='';
< foreach ( $licenseList->mList as $index => $license ) {
< $selected = ($index == 5) ? 'selected="selected"' : '';
< $licIdOptions .= "<option value=\"$index\" $selected>$license->lic_name</option>\n";
< }
< echo "$licIdOptions</select></label></div>";
<
< ?>
< </td>
< </tr>
<
< <!--Cambio -->
<
103c72
< <td align='right'><label for='wpRealName'><?php $this->msg('realname') ?>:</label></td>
---
> <td align='right'><label for='wpRealName'><?php $this->msg('yourrealname') ?>:</label></td>
108d76
<
110d77
<
121d87
<
136d101
[edit] Cambios en includes/User.php
33d32
< var $defaultLicense; #Cambio
527d525
< $this->defaultLicense=1; #Cambio
535c533
< "user_options,user_touched,user_token,ur_rights, user_default_lic " . #Cambio
---
> "user_options,user_touched,user_token,ur_rights " .
554d551
< $this->defaultLicense=$s->user_default_lic; #Cambio
583,594d579
< #****************** Cambio
< function getLicense() {
< $this->loadFromDatabase();
< return $this->defaultLicense;
< }
<
< function setLicense($lic) {
< $this->loadFromDatabase();
< $this->defaultLicense= $lic;
< }
< #****************** Cambio
<
1019,1020c1004
< 'user_token' => $this->mToken,
< 'user_default_lic' => $this->defaultLicense #cambio
---
> 'user_token' => $this->mToken
1118,1119c1102
< 'user_token' => $this->mToken,
< 'user_default_lic' => $this->defaultLicense #cambio
---
> 'user_token' => $this->mToken

