Browse Source

Updated download.php, compatibility to gentoo php

merge-requests/2/head
Christoph Haas 4 years ago
parent
commit
456565c89c
2 changed files with 138 additions and 204 deletions
  1. +97
    -166
      .idea/workspace.xml
  2. +41
    -38
      php/download.php

+ 97
- 166
.idea/workspace.xml View File

@ -2,8 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="aae153d8-808f-4371-b0e9-9ee7ff904cab" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/changelog.txt" afterPath="$PROJECT_DIR$/changelog.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/manifest.xml" afterPath="$PROJECT_DIR$/manifest.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/php/download.php" afterPath="$PROJECT_DIR$/php/download.php" />
</list>
<ignored path="contactimporter.iws" />
<ignored path=".idea/workspace.xml" />
@ -23,95 +23,17 @@
<favorites_list name="contactimporter" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="ContextMenu.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/ui/ContextMenu.js">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="download.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/php/download.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="159">
<caret line="101" column="8" selection-start-line="101" selection-start-column="8" selection-end-line="104" selection-end-column="0" />
<state relative-caret-position="90">
<caret line="27" column="22" selection-start-line="27" selection-start-column="22" selection-end-line="27" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="plugin.contactimporter.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/plugin.contactimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2670">
<caret line="80" column="0" selection-start-line="80" selection-start-column="0" selection-end-line="80" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ABOUT.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/ABOUT.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="39" selection-start-line="25" selection-start-column="39" selection-end-line="25" selection-end-column="39" />
<folding>
<marker date="1480430157843" expanded="true" signature="1216:1220" ph="&lt;" />
<marker date="1480430157843" expanded="true" signature="1246:1250" ph="&gt;" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="config.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="75" selection-start-line="8" selection-start-column="75" selection-end-line="8" selection-end-column="75" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="changelog.txt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/changelog.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="25" selection-start-line="17" selection-start-column="25" selection-end-line="17" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="manifest.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/manifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="22" selection-start-line="4" selection-start-column="22" selection-end-line="4" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="270">
<caret line="18" column="0" selection-start-line="18" selection-start-column="0" selection-end-line="21" selection-end-column="43" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ImportPanel.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
<caret line="581" column="8" selection-start-line="581" selection-start-column="8" selection-end-line="583" selection-end-column="8" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
@ -120,7 +42,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/php/download.php" />
<option value="$PROJECT_DIR$/php/module.contact.php" />
<option value="$PROJECT_DIR$/php/plugin.contactimporter.php" />
<option value="$PROJECT_DIR$/config.php" />
@ -134,6 +55,7 @@
<option value="$PROJECT_DIR$/js/plugin.contactimporter.js" />
<option value="$PROJECT_DIR$/changelog.txt" />
<option value="$PROJECT_DIR$/manifest.xml" />
<option value="$PROJECT_DIR$/php/download.php" />
</list>
</option>
</component>
@ -175,11 +97,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope">
<subPane subId="Project Files" />
<subPane subId="Default" />
</pane>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
@ -212,46 +129,6 @@
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="contactimporter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="contactimporter" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="languages" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="en_US.UTF-8" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="contactimporter" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="contactimporter" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="languages" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="en_US.UTF-8" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="LC_MESSAGES" />
<option name="myItemType" value="com.jetbrains.php.projectView.PhpTreeStructureProvider$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="contactimporter" />
@ -336,10 +213,15 @@
</PATH>
</subPane>
</pane>
<pane id="Scope">
<subPane subId="Project Files" />
<subPane subId="Default" />
</pane>
<pane id="Scratches" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../calendarimporter" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="js-jscs-nodeInterpreter" value="/usr/bin/node" />
</component>
@ -403,12 +285,13 @@
<updated>1480428196914</updated>
<workItem from="1480428199144" duration="44000" />
<workItem from="1480428259775" duration="69000" />
<workItem from="1480428330068" duration="6578000" />
<workItem from="1480428330068" duration="6691000" />
<workItem from="1480504955898" duration="153000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="6691000" />
<option name="totallyTimeSpent" value="6957000" />
</component>
<component name="ToolWindowManager">
<frame x="65" y="24" width="1792" height="999" extended-state="6" />
@ -451,15 +334,42 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/languages/de_DE.UTF-8/language.txt">
<entry file="file://$PROJECT_DIR$/js/ui/ContextMenu.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="1515">
<caret line="101" column="8" selection-start-line="101" selection-start-column="8" selection-end-line="104" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/css/contactimporter-main.css">
<entry file="file://$PROJECT_DIR$/js/plugin.contactimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1200">
<caret line="80" column="0" selection-start-line="80" selection-start-column="0" selection-end-line="80" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/ABOUT.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="39" selection-start-line="25" selection-start-column="39" selection-end-line="25" selection-end-column="39" />
<folding>
<marker date="1480430157843" expanded="true" signature="1216:1220" ph="&lt;" />
<marker date="1480430157843" expanded="true" signature="1246:1250" ph="&gt;" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="75" selection-start-line="8" selection-start-column="75" selection-end-line="8" selection-end-column="75" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/changelog.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@ -467,39 +377,61 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/fields.txt">
<entry file="file://$PROJECT_DIR$/manifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3900">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="60">
<caret line="4" column="22" selection-start-line="4" selection-start-column="22" selection-end-line="4" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportContentPanel.js">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="270">
<caret line="18" column="0" selection-start-line="18" selection-start-column="0" selection-end-line="21" selection-end-column="43" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="474">
<caret line="44" column="20" selection-start-line="44" selection-start-column="20" selection-end-line="44" selection-end-column="55" />
<state relative-caret-position="8415">
<caret line="581" column="8" selection-start-line="581" selection-start-column="8" selection-end-line="583" selection-end-column="8" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/data/ResponseHandler.js">
<entry file="file://$PROJECT_DIR$/languages/de_DE.UTF-8/language.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1200">
<caret line="80" column="13" selection-start-line="80" selection-start-column="8" selection-end-line="80" selection-end-column="13" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/php/download.php">
<entry file="file://$PROJECT_DIR$/resources/css/contactimporter-main.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-225">
<caret line="3" column="15" selection-start-line="3" selection-start-column="15" selection-end-line="3" selection-end-column="57" />
<folding />
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/fields.txt" />
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportContentPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="474">
<caret line="44" column="20" selection-start-line="44" selection-start-column="20" selection-end-line="44" selection-end-column="55" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/js/data/ResponseHandler.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1200">
<caret line="80" column="13" selection-start-line="80" selection-start-column="8" selection-end-line="80" selection-end-column="13" />
</state>
</provider>
</entry>
@ -507,10 +439,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-16319">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<folding>
<element signature="e#6#919#0#PHP" expanded="true" />
<element signature="e#959#992#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -518,7 +446,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="675">
<caret line="84" column="83" selection-start-line="84" selection-start-column="83" selection-end-line="84" selection-end-column="83" />
<folding />
</state>
</provider>
</entry>
@ -526,9 +453,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="780">
<caret line="72" column="1" selection-start-line="72" selection-start-column="1" selection-end-line="72" selection-end-column="1" />
<folding>
<element signature="e#6#911#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -536,7 +460,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -550,7 +473,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/js/dialogs/ImportPanel.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
<state relative-caret-position="8415">
<caret line="581" column="8" selection-start-line="581" selection-start-column="8" selection-end-line="583" selection-end-column="8" />
<folding>
<element signature="n#!!doc" expanded="true" />
@ -560,7 +483,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/js/ui/ContextMenu.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="159">
<state relative-caret-position="1515">
<caret line="101" column="8" selection-start-line="101" selection-start-column="8" selection-end-line="104" selection-end-column="0" />
<folding />
</state>
@ -595,7 +518,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/js/plugin.contactimporter.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2670">
<state relative-caret-position="1200">
<caret line="80" column="0" selection-start-line="80" selection-start-column="0" selection-end-line="80" selection-end-column="0" />
<folding />
</state>
@ -620,6 +543,14 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/php/download.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="27" column="22" selection-start-line="27" selection-start-column="22" selection-end-line="27" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>


+ 41
- 38
php/download.php View File

@ -23,49 +23,52 @@
*/
class DownloadHandler
{
/**
* Download the given vcf file.
*/
public static function doDownload()
{
if (isset($_GET["token"])) {
$token = $_GET["token"];
} else {
return false;
}
/**
* Download the given vcf file.
* @return boolean
*/
public static function doDownload()
{
if (isset($_GET["token"])) {
$token = $_GET["token"];
} else {
return false;
}
if (isset($_GET["filename"])) {
$filename = $_GET["filename"];
} else {
return false;
}
if (isset($_GET["filename"])) {
$filename = $_GET["filename"];
} else {
return false;
}
// validate token
if (!ctype_alnum($token)) { // token is a md5 hash
return false;
}
// validate token
if (!preg_match('/^[a-zA-Z0-9]+$/', $token)) { // token is a md5 hash
return false;
}
$file = PLUGIN_CONTACTIMPORTER_TMP_UPLOAD . "vcf_" . $token . ".vcf";
$file = PLUGIN_CONTACTIMPORTER_TMP_UPLOAD . "vcf_" . $token . ".vcf";
if (!file_exists($file)) { // invalid token
return false;
}
if (!file_exists($file)) { // invalid token
return false;
}
// set headers here
header('Content-Disposition: attachment; filename="' . $filename . '"');
// set headers here
header('Content-Disposition: attachment; filename="' . $filename . '"');
// no caching
header('Expires: 0'); // set expiration time
header('Content-Description: File Transfer');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: ' . filesize($file));
header('Content-Type: application/octet-stream');
header('Pragma: public');
flush();
// no caching
header('Expires: 0'); // set expiration time
header('Content-Description: File Transfer');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: ' . filesize($file));
header('Content-Type: application/octet-stream');
header('Pragma: public');
flush();
// print the downloaded file
readfile($file);
ignore_user_abort(true);
unlink($file);
}
// print the downloaded file
readfile($file);
ignore_user_abort(true);
unlink($file);
return true;
}
}

Loading…
Cancel
Save