2018-01-09 02:09:07 +03:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @package Kleeja
|
2020-04-11 22:45:48 +02:00
|
|
|
* @copyright (c) 2007 Kleeja.net
|
2018-01-09 02:09:07 +03:00
|
|
|
* @license ./docs/license.txt
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2019-05-03 23:52:08 +03:00
|
|
|
//no direct access
|
|
|
|
|
if (! defined('IN_COMMON'))
|
2018-01-09 02:09:07 +03:00
|
|
|
{
|
2019-05-03 23:52:08 +03:00
|
|
|
exit();
|
2018-01-09 02:09:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface KleejaUploader
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* set the allowed extensions of uploaded files
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param array $allowed_file_extensions an array of allowed extensions, and sizes ['gif'=>122, 'png'=>2421 ..]
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function setAllowedFileExtensions($allowed_file_extensions);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get the allowed extensions of uploaded files
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function getAllowedFileExtensions();
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set the allowed limit of the uploaded files
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param int $limit
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function setUploadFieldsLimit($limit);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get the allowed limit of the uploaded files
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function getUploadFieldsLimit();
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* add an information message to output it to the user
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param string $message
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function addInfoMessage($message);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* add an error message to output it to the user
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param string $message
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function addErrorMessage($message);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get all the messages
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function getMessages();
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* save the file information to the database
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param array $fileInfo
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function saveToDatabase($fileInfo);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* generate a box of the result and add it to addInfoMessage
|
2019-05-03 23:52:08 +03:00
|
|
|
* @param array $fileInfo
|
2018-01-09 02:09:07 +03:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-03 23:52:08 +03:00
|
|
|
public function generateOutputBox($fileInfo);
|
2018-01-09 02:09:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* here happens the magic, call this on upload submit
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-05-18 01:47:17 +03:00
|
|
|
public function upload();
|
2018-01-09 02:09:07 +03:00
|
|
|
}
|