Made download.php compatible to gentoo php

This commit is contained in:
Christoph Haas 2016-11-30 11:13:03 +01:00
parent 57a35096a6
commit 64fa5e3cbd
2 changed files with 43 additions and 30 deletions

View File

@ -2,9 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e7c9c2bb-66f1-4e37-904c-d33d8c113bde" name="Default" comment=""> <list default="true" id="e7c9c2bb-66f1-4e37-904c-d33d8c113bde" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/php/helper.php" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/php/download.php" afterPath="$PROJECT_DIR$/php/download.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/php/upload.php" afterPath="$PROJECT_DIR$/php/upload.php" />
</list> </list>
<ignored path="calendarimporter.iws" /> <ignored path="calendarimporter.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
@ -25,18 +23,6 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="upload.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/php/upload.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="24" column="38" selection-start-line="24" selection-start-column="38" selection-end-line="24" selection-end-column="38" />
<folding>
<element signature="e#6#905#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="module.calendar.php" pinned="false" current-in-tab="false"> <file leaf-file-name="module.calendar.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/php/module.calendar.php"> <entry file="file://$PROJECT_DIR$/php/module.calendar.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -51,6 +37,30 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="upload.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/php/upload.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="29" selection-end-column="28" />
<folding>
<element signature="e#6#905#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<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="345">
<caret line="46" column="23" selection-start-line="46" selection-start-column="13" selection-end-line="46" selection-end-column="23" />
<folding>
<element signature="e#7#908#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="helper.php" pinned="false" current-in-tab="false"> <file leaf-file-name="helper.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/php/helper.php"> <entry file="file://$PROJECT_DIR$/php/helper.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -84,7 +94,6 @@
<option value="$PROJECT_DIR$/changelog.txt" /> <option value="$PROJECT_DIR$/changelog.txt" />
<option value="$PROJECT_DIR$/Makefile" /> <option value="$PROJECT_DIR$/Makefile" />
<option value="$PROJECT_DIR$/manifest.xml" /> <option value="$PROJECT_DIR$/manifest.xml" />
<option value="$PROJECT_DIR$/php/download.php" />
<option value="$PROJECT_DIR$/php/plugin.calendarimporter.php" /> <option value="$PROJECT_DIR$/php/plugin.calendarimporter.php" />
<option value="$PROJECT_DIR$/build.xml" /> <option value="$PROJECT_DIR$/build.xml" />
<option value="$PROJECT_DIR$/js/ABOUT.js" /> <option value="$PROJECT_DIR$/js/ABOUT.js" />
@ -107,6 +116,7 @@
<option value="$PROJECT_DIR$/php/Helper.php" /> <option value="$PROJECT_DIR$/php/Helper.php" />
<option value="$PROJECT_DIR$/php/helper.php" /> <option value="$PROJECT_DIR$/php/helper.php" />
<option value="$PROJECT_DIR$/php/upload.php" /> <option value="$PROJECT_DIR$/php/upload.php" />
<option value="$PROJECT_DIR$/php/download.php" />
</list> </list>
</option> </option>
</component> </component>
@ -270,12 +280,12 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1477949602474</updated> <updated>1477949602474</updated>
<workItem from="1477949603566" duration="9204000" /> <workItem from="1477949603566" duration="9204000" />
<workItem from="1480441197414" duration="6911000" /> <workItem from="1480441197414" duration="7267000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="16115000" /> <option name="totallyTimeSpent" value="16471000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="65" y="24" width="1792" height="999" extended-state="6" /> <frame x="65" y="24" width="1792" height="999" extended-state="6" />
@ -640,12 +650,12 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/php/download.php"> <entry file="file://$PROJECT_DIR$/php/helper.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75"> <state relative-caret-position="690">
<caret line="23" column="26" selection-start-line="23" selection-start-column="10" selection-end-line="23" selection-end-column="26" /> <caret line="56" column="41" selection-start-line="56" selection-start-column="41" selection-end-line="56" selection-end-column="41" />
<folding> <folding>
<element signature="e#7#908#0#PHP" expanded="true" /> <element signature="e#6#905#0#PHP" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -662,22 +672,22 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/php/helper.php"> <entry file="file://$PROJECT_DIR$/php/upload.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="690"> <state relative-caret-position="340">
<caret line="56" column="41" selection-start-line="56" selection-start-column="41" selection-end-line="56" selection-end-column="41" /> <caret line="24" column="0" selection-start-line="24" selection-start-column="0" selection-end-line="29" selection-end-column="28" />
<folding> <folding>
<element signature="e#6#905#0#PHP" expanded="true" /> <element signature="e#6#905#0#PHP" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/php/upload.php"> <entry file="file://$PROJECT_DIR$/php/download.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360"> <state relative-caret-position="345">
<caret line="24" column="38" selection-start-line="24" selection-start-column="38" selection-end-line="24" selection-end-column="38" /> <caret line="46" column="23" selection-start-line="46" selection-start-column="13" selection-end-line="46" selection-end-column="23" />
<folding> <folding>
<element signature="e#6#905#0#PHP" expanded="true" /> <element signature="e#7#908#0#PHP" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>

View File

@ -27,6 +27,7 @@ class DownloadHandler
{ {
/** /**
* Download the given vcf file. * Download the given vcf file.
* @return boolean
*/ */
public static function doDownload() public static function doDownload()
{ {
@ -43,7 +44,7 @@ class DownloadHandler
} }
// validate token // validate token
if (!ctype_alnum($token)) { // token is a md5 hash if (!preg_match('/^[a-zA-Z0-9]+$/', $token)) { // token is a md5 hash
return false; return false;
} }
@ -69,5 +70,7 @@ class DownloadHandler
readfile($file); readfile($file);
ignore_user_abort(true); ignore_user_abort(true);
unlink($file); unlink($file);
return true;
} }
} }