dolibarr 23.0.3
upload_page2.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This file is a modified version of datepicker.php from phpBSM to fix some
7 * bugs, to add new features and to dramatically increase speed.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28require_once '../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38
39
40if (GETPOST('lang', 'aZ09')) {
41 $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
42}
43
44$langs->loadLangs(array("main", "other"));
45
46$action = GETPOST('action', 'aZ09');
47$modulepart = GETPOST('modulepart', 'aZ09');
48
49$upload_dir = $conf->admin->dir_temp.'/import';
50
51// Delete the temporary files that are used when uploading files
52//dol_delete_file($upload_dir.'/upload_page-by'.$user->id.'-*');
53
54$file = GETPOST('file');
55
56$reg = array();
57if (preg_match('/^upload_page-by(\d+)-([a-z_]+)-(\d+)/', $file, $reg)) {
58 $modulepart = $reg[2];
59
60 if ($reg[1] != $user->id) {
61 accessforbidden('User id for file to process does not match current user id');
62 }
63} else {
64 accessforbidden('Bad value for file parameter');
65}
66
67
68/*
69 * Actions
70 */
71
72//
73
74
75
76/*
77 * View
78 */
79
80//$form = new Form($db);
81
82$title = $langs->trans("UploadFile");
83$help_url = '';
84
85$arrayofjs = array();
86$arrayofcss = array();
87
88llxHeader('', $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', 'mod-upload page-card');
89//top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
90
91print load_fiche_titre('', '', '', 0, '', '', '<h2>'.img_picto('', 'upload').' '.$title.'</h2>');
92
93// Show all forms
94print "\n";
95print "<!-- Begin Form -->\n";
96print '<form id="uploadform" enctype="multipart/form-data" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
97print '<input type="hidden" name="token" value="'.newToken().'">';
98print '<input type="hidden" name="action" value="uploadfile">';
99print '<input type="hidden" name="sendit" value="1">';
100print '<input type="hidden" name="modulepart" id="modulepart" value="">';
101print '<input type="hidden" name="overwritefile" value="1">';
102
103print "<script>
104$(document).ready(function() {
105
106});
107</script>";
108
109print $file;
110
111
112print '</form>';
113print "\n<!-- End Form -->\n";
114
115
116
117// End of page
118llxFooter();
119$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.