Commit cc89e680 authored by Robert Lyon's avatar Robert Lyon Committed by Gold
Browse files

Bug 1907019: Fix adding licence via zipfile



And displaying the local font licence file that is stored in dataroot
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>

Change-Id: Ieea9522a0f0c5f23e9ecf9f50de6a16f6aaaa3b5
parent 0b26910d
......@@ -266,6 +266,9 @@ function addfontform_submit(Pieform $form, $values) {
}
}
}
if (isset($values['fontfileTXT']['name'])) {
$values['fontfilelicence']['name'] = $values['fontfileTXT']['name'];
}
}
}
......
......@@ -33,12 +33,19 @@ if (!empty($font)) {
$fonttitle = $fontdata->title;
if (!empty($fontdata->licence) && !is_null($fontdata->licence)) {
if (preg_match('/^t_(.*)/', $fontdata->fonttype, $matches)) {
$fontpath = get_config('wwwroot') . 'theme/' . $matches[1] . '/fonts/' . strtolower($fontdata->name) . '/';
$fontpath = 'theme/' . $matches[1] . '/fonts/' . strtolower($fontdata->name) . '/' . $fontdata->licence;
}
else {
$fontpath = get_config('wwwroot') . 'skins/fonts/' . $fontdata->name . '/';
$fontpath = 'skins/fonts/' . $fontdata->name . '/' . $fontdata->licence;
}
$fontlicence = '<a href="' . $fontpath . $fontdata->licence . '">' . get_string('fontlicence', 'skin') . '</a>';
if (!file_exists(get_config('docroot') . $fontpath)) {
// Try the dataroot
if (file_exists(get_config('dataroot') . 'skins/fonts/' . $fontdata->name . '/' . $fontdata->licence)) {
$fontpath = 'skin/licence.php?family=' . $fontdata->title;
}
}
$fontlicence = '<a href="' . get_config('wwwroot') . $fontpath . '">' . get_string('fontlicence', 'skin') . '</a>';
}
else {
$fontlicence = get_string('fontlicencenotfound', 'skin');
......
<?php
/**
*
* @package mahara
* @subpackage skin
* @author Gregor Anzelj
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
* @copyright (C) 2010-2013 Gregor Anzelj <gregor.anzelj@gmail.com>
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('file.php');
if (!get_config('skins')) {
throw new FeatureNotEnabledException();
}
$family = param_variable('family');
$fontrec = get_record('skin_fonts', 'title', $family);
if (
!$fontrec
|| !$fontrec->licence
) {
throw new NotFoundException();
}
$licencepath = get_config('dataroot') . 'skins/fonts/' . $fontrec->name . '/' . $fontrec->licence;
$options = array('forcedownload' => true);
serve_file($licencepath, $fontrec->licence, pathinfo($licencepath, PATHINFO_EXTENSION), $options);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment