Skip to content

Commit

Permalink
Added allow_pdf_localhost_ip, for hosts that don't show 127.0.0.1 or …
Browse files Browse the repository at this point in the history
…::1 when CURL to local
  • Loading branch information
cheesegrits committed Nov 5, 2016
1 parent 0ca1d32 commit 587e03c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions administrator/components/com_fabrik/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@
<option value="1">JYES</option>
</field>

<field name="allow_pdf_localhost_ip"
type="text"
default=""
description="COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_IP_DESC"
label="COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_IP_DESC" />


<field name="actionMethod"
default="floating"
type="list"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ COM_FABRIK_FIELD_FORM_PDF_ICON_DESC="Should the PDF button be shown, this option
COM_FABRIK_FIELD_FORM_PDF_ICON_LABEL="Show PDF button"
COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_VIEW_DESC="In some cases, like the list download plugin, Fabrik builds PDF views by making CURL calls to localhost. This allows us to provide PDF output we wouldn't otherwise be able to do, but does sacrifice security, because those calls are always going to be guest access, without the credentials of the logged on user. By enabling this option, you can bypass list view ACLs for requests coming from localhost, allowing you to retain ACLs for normal viewing"
COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_VIEW_LABEL="Allow PDF Localhost"
COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_IP_DESC="When using Allow PDF Localhost, you may need to enter your server's private IP here, usually 192.168.x.x"
COM_FABRIK_FIELD_LIST_ALLOW_PDF_LOCALHOST_IP_LABEL="Allow PDF IP"
COM_FABRIK_FIELD_FORM_PRINT_ICON_DESC="Should the print button be shown, this option is only used if the form's 'Print icon' property is set to 'Use Global'"
COM_FABRIK_FIELD_FORM_PRINT_ICON_LABEL="Show print button"
COM_FABRIK_FIELD_FORM_TEMPLATE_DESC="The folder located in components/com_fabrik/views/form/tmpl/ that is used as a template when viewing the form"
Expand Down
6 changes: 6 additions & 0 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -4033,6 +4033,12 @@ public function canViewDetails()
'127.0.0.1',
'::1'
);
$pdfLocalhostIP = $config->get('allow_pdf_localhost_ip', '');

if (!empty($pdfLocalhostIP))
{
$whitelist[] = $pdfLocalhostIP;
}

if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){
$allowPDF = true;
Expand Down

0 comments on commit 587e03c

Please sign in to comment.