diff --git a/ChangeLog b/ChangeLog index e54b306462..d9b9dc6345 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,7 @@ phpMyAdmin - ChangeLog 4.1.12.0 (not yet released) - bug #4334 Add event : datepicker won't open - bug #4338 Fix missing value error while executing SQL query +- TCPDF library is now optional dependency 4.1.11.0 (2014-03-23) - bug #4335 reCaptcha problem (4.1.10 regression) diff --git a/libraries/plugins/export/ExportPdf.class.php b/libraries/plugins/export/ExportPdf.class.php index ffabb96efa..876f0700bb 100644 --- a/libraries/plugins/export/ExportPdf.class.php +++ b/libraries/plugins/export/ExportPdf.class.php @@ -10,6 +10,14 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * Skip the plugin if TCPDF is not available. + */ +if (! file_exists(TCPDF_INC)) { + $GLOBALS['skip_import'] = true; + return; +} + /* Get the export interface */ require_once 'libraries/plugins/ExportPlugin.class.php'; /* Get the PMA_ExportPdf class */ @@ -265,4 +273,4 @@ class ExportPdf extends ExportPlugin $this->_pdfReportTitle = $pdfReportTitle; } } -?> \ No newline at end of file +?> diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index f170ce959c..2272303e32 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -9,6 +9,21 @@ if (! defined('PHPMYADMIN')) { exit; } +/** + * Skip the plugin if TCPDF is not available. + */ +if (! file_exists(TCPDF_INC)) { + $GLOBALS['skip_import'] = true; + return; +} + +/** + * block attempts to directly run this script + */ +if (getcwd() == dirname(__FILE__)) { + die('Attack stopped'); +} + require_once 'Export_Relation_Schema.class.php'; require_once './libraries/PDF.class.php'; diff --git a/libraries/schema/User_Schema.class.php b/libraries/schema/User_Schema.class.php index b64898e3ad..968cf78cc5 100644 --- a/libraries/schema/User_Schema.class.php +++ b/libraries/schema/User_Schema.class.php @@ -419,12 +419,19 @@ class PMA_User_Schema $htmlString .= PMA_Util::getImage('b_views.png'); } + /* + * TODO: This list should be generated dynamically based on list of + * available plugins. + */ $htmlString .= __('Display relational schema') . ':' . '' - . ''; + if (file_exists(TCPDF_INC)) { + $htmlString .= ''; + } + $htmlString .= + '' . '' . '' . '' @@ -663,7 +670,15 @@ class PMA_User_Schema __('File doesn\'t exist') ); } + $GLOBALS['skip_import'] = false; include $filename; + if ( $GLOBALS['skip_import']) { + PMA_Export_Relation_Schema::dieSchema( + $_POST['chpage'], + $export_type, + __('Plugin is disabled') + ); + } $class_name = 'PMA_' . $path . '_Relation_Schema'; $obj_schema = new $class_name(); $obj_schema->showOutput();