echo '<p>' . t('This will return brut text content.') . ' ' .\r
t('First line is the download reference and the second line the delete code.') . '<br /></p>';\r
\r
- if ($cfg['enable_blocks'])\r
- {\r
- echo '<h3>' . t('Create a data block') . ':</h3>';\r
- echo '<p>';\r
- echo t('This interface permits to create a block of data filled with zeros.') .\r
- ' ' . t('You can read selected parts, write (using a code) and delete the block.') .\r
- ' ' . t('Blocks may be removed after a month of non usage.');\r
- echo '</p>';\r
- echo '<p>';\r
- echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?init_block</i><br />';\r
- echo '<br />';\r
- echo t('Parameters') . ':<br />';\r
- echo "<b>size=</b>size_in_bytes<i> (" . t('Required') . ")</i> <br />";\r
- echo '</p>';\r
- echo '<p>' . t('This will return brut text content.') . ' ' .\r
- t('First line is a block id the second line the edit/delete code.') . '<br /></p>';\r
-\r
- echo '<h3>' . t('Get block size') . ':</h3>';\r
- echo '<p>';\r
- echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?get_block_size</i><br />';\r
- echo '<br />';\r
- echo t('Parameters') . ':<br />';\r
- echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";\r
- echo '</p>';\r
- echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';\r
-\r
- echo '<h3>' . t('Read data in a block') . ':</h3>';\r
- echo '<p>';\r
- echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?read_block</i><br />';\r
- echo '<br />';\r
- echo t('Parameters') . ':<br />';\r
- echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>length=</b>length_to_read_in_bytes<i> (" . t('Required') . ")</i> <br />";\r
- echo '</p>';\r
- echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';\r
-\r
- echo '<h3>' . t('Write data in a block') . ':</h3>';\r
- echo '<p>';\r
- echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?write_block</i><br />';\r
- echo '<br />';\r
- echo t('Parameters') . ':<br />';\r
- echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>data=</b>data_to_write<i> (" . t('Required') . ")</i> <br />";\r
- echo '</p>';\r
- echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';\r
-\r
- echo '<h3>' . t('Delete a block') . ':</h3>';\r
- echo '<p>';\r
- echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?delete_block</i><br />';\r
- echo '<br />';\r
- echo t('Parameters') . ':<br />';\r
- echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";\r
- echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";\r
- echo '</p>';\r
- echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';\r
- }\r
-\r
echo '</div><br />';\r
require (JIRAFEAU_ROOT . 'lib/template/footer.php');\r
exit;\r
if (isset ($_FILES['file']) && is_writable (VAR_FILES)\r
&& is_writable (VAR_LINKS))\r
{\r
- if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))\r
+ if (jirafeau_has_upload_password ($cfg) &&\r
+ (!isset ($_POST['upload_password']) ||\r
+ !jirafeau_challenge_upload_password ($cfg, $_POST['upload_password'])))\r
{\r
echo "Error";\r
exit;\r
/* Initialize an asynchronous upload. */\r
elseif (isset ($_GET['init_async']))\r
{\r
- if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))\r
+ if (jirafeau_has_upload_password ($cfg) &&\r
+ (!isset ($_POST['upload_password']) ||\r
+ !jirafeau_challenge_upload_password ($cfg, $_POST['upload_password'])))\r
{\r
echo "Error";\r
exit;\r
else\r
echo jirafeau_async_end ($_POST['ref'], $_POST['code'], $cfg['enable_crypt'], $cfg['link_name_lenght']);\r
}\r
-/* Initialize block. */\r
-elseif (isset ($_GET['init_block']) && $cfg['enable_blocks'])\r
-{\r
- if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))\r
- {\r
- echo "Error";\r
- exit;\r
- }\r
-\r
- if (!isset ($_POST['size']))\r
- echo "Error";\r
- else\r
- echo jirafeau_block_init ($_POST['size']);\r
-}\r
-/* Get block size. */\r
-elseif (isset ($_GET['get_block_size']) && $cfg['enable_blocks'])\r
-{\r
- if (!isset ($_POST['id']))\r
- echo "Error";\r
- else\r
- echo jirafeau_block_get_size ($_POST['id']);\r
-}\r
-/* Read data in block. */\r
-elseif (isset ($_GET['read_block']) && $cfg['enable_blocks'])\r
-{\r
- if (!isset ($_POST['id'])\r
- || !isset ($_POST['start'])\r
- || !isset ($_POST['length']))\r
- echo "Error";\r
- else\r
- jirafeau_block_read ($_POST['id'], $_POST['start'], $_POST['length']);\r
-}\r
-/* Write data in block. */\r
-elseif (isset ($_GET['write_block']) && $cfg['enable_blocks'])\r
-{\r
- if (!isset ($_POST['id'])\r
- || !isset ($_POST['start'])\r
- || !isset ($_FILES['data'])\r
- || !isset ($_POST['code']))\r
- echo "Error";\r
- else\r
- echo jirafeau_block_write ($_POST['id'], $_POST['start'], $_FILES['data'], $_POST['code']);\r
-}\r
-/* Delete block. */\r
-elseif (isset ($_GET['delete_block']) && $cfg['enable_blocks'])\r
-{\r
- if (!isset ($_POST['id'])\r
- || !isset ($_POST['code']))\r
- echo "Error";\r
- else\r
- echo jirafeau_block_delete ($_POST['id'], $_POST['code']);\r
-}\r
else\r
echo "Error";\r
exit;\r