Compare commits
No commits in common. "dc98374fe4aed989e1b485a70a8bbac07e8fec6e" and "d750ff8c23bbdc050a5378cfa949d57e24bf3760" have entirely different histories.
dc98374fe4
...
d750ff8c23
@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
// fix_font_path.php
|
|
||||||
// Run this script on your server to fix the 'amiri.ttf' path issue.
|
|
||||||
|
|
||||||
header('Content-Type: text/plain');
|
|
||||||
|
|
||||||
$targetFile = __DIR__ . '/includes/fpdf/font/unifont/amiri.mtx.php';
|
|
||||||
|
|
||||||
if (!file_exists($targetFile)) {
|
|
||||||
echo "Error: File not found at $targetFile\n";
|
|
||||||
echo "Please ensure you uploaded the 'includes' folder correctly.\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = file_get_contents($targetFile);
|
|
||||||
if ($content === false) {
|
|
||||||
echo "Error: Could not read file.\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for the bad path
|
|
||||||
if (strpos($content, '/home/ubuntu/executor/workspace') !== false) {
|
|
||||||
echo "Found incorrect path in file. Fixing...\n";
|
|
||||||
|
|
||||||
// Replace with dynamic path
|
|
||||||
$newContent = preg_replace(
|
|
||||||
"/\'[^\']+\/amiri\.ttf\'/",
|
|
||||||
"dirname(__FILE__) . '/amiri.ttf'",
|
|
||||||
$content
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($newContent === null || $newContent === $content) {
|
|
||||||
// Fallback: manual string replacement if regex fails
|
|
||||||
$newContent = str_replace(
|
|
||||||
"'/home/ubuntu/executor/workspace/includes/fpdf/font/unifont/amiri.ttf'",
|
|
||||||
"dirname(__FILE__) . '/amiri.ttf'",
|
|
||||||
$content
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_put_contents($targetFile, $newContent)) {
|
|
||||||
echo "SUCCESS: File updated successfully!\n";
|
|
||||||
echo "Old path removed. New path is dynamic.\n";
|
|
||||||
echo "Please delete this script and try downloading the PDF again.\n";
|
|
||||||
} else {
|
|
||||||
echo "Error: Could not write to file. Check permissions.\n";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "File appears to be correct already.\n";
|
|
||||||
echo "Current content snippet:\n";
|
|
||||||
echo substr($content, 0, 500) . "\n...\n";
|
|
||||||
|
|
||||||
// Check if it's using dirname(__FILE__)
|
|
||||||
if (strpos($content, 'dirname(__FILE__)') !== false) {
|
|
||||||
echo "It is using dirname(__FILE__), which is good.\n";
|
|
||||||
} else {
|
|
||||||
echo "Warning: It is NOT using dirname(__FILE__). It might be hardcoded to something else?\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@ -13,7 +13,7 @@ $desc=array (
|
|||||||
);
|
);
|
||||||
$up=-512;
|
$up=-512;
|
||||||
$ut=50;
|
$ut=50;
|
||||||
$ttffile=dirname(__FILE__) . '/amiri.ttf';
|
$ttffile='/home/ubuntu/executor/workspace/includes/fpdf/font/unifont/amiri.ttf';
|
||||||
$originalsize=431116;
|
$originalsize=431116;
|
||||||
$fontkey='amiri';
|
$fontkey='amiri';
|
||||||
?>
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user