Well, it is a kind of privacy issue. Most users doesn't pay attention on the privacy settings and the default setting is to make the file public.
If you know something about php, follow those steps to add hashes to folders:
1) Add a field "shortUrl" on the file_folder table. Make it a binary field with 8 bytes and add an unique index to it.
2) Locate the function loadById in the include/fileFolder.class.php.
Change the class declaration to public static function loadById($id, $shortUrl = false) {
Change the line $row = $db->getRow('SELECT * FROM file_folder WHERE id = ' . (int) $id ); to if (!$shortUrl) $row = $db->getRow('SELECT * FROM file_folder WHERE id = '.(int)$id); and add the line else $row = $db->getRow('SELECT * FROM file_folder WHERE shortUrl = UNHEX('.$db->quote($id).')'); just bellow it.
3) Open the file /templates/ajax/_account_edit_folder.process.ajax.php and locate the line starting with $rs = $db->query('INSERT INTO file_folder (folderName, isPublic, userId, parentId, shortUrl) and replace it with this code:
while (true) {
$hash = substr(md5(uniqid().mt_rand(0, 99999)), 0, 16);
if (!$db->numRows('SELECT id FROM file_folder WHERE shortUrl = UNHEX('.$db->quote($hash).') LIMIT 1')) break;
}
$rs = $db->query('INSERT INTO file_folder (folderName, isPublic, userId, parentId, shortUrl)
VALUES
folderName, :isPublic, :userId,
arentId, UNHEX
shortUrl))',
array(
'folderName' => $folderName,
'isPublic' => $isPublic,
'userId' => $Auth->id,
'parentId' => $parentId,
'shortUrl' => $hash
)
);
4) Open the file /templates/ajax/_account_edit_folder.ajax.php and add the line $shortUrl = bin2hex($fileFolder->shortUrl); just after the line $editFolderId = $fileFolder->id;
In the form field displaying the folder url, use the $shortUrl instead of the folder id.
5) Open the file /template/view_folder.html. The first 11 lines of this file should be like the following:
<?php
// initial checks
$folderUrl = $_GET['_page_url'];
// make sure it's a public folder or the owner is logged in
if ($folderUrl) {
$fileFolder = fileFolder::loadById($folderUrl, true);
if (!$fileFolder) coreFunctions::redirect(WEB_ROOT.SITE_CONFIG_PAGE_EXTENSION);
$folderId = $fileFolder->id;
In this page there is a form to submit password for password protected folders. In the form action, replace the folder id with bin2hex($fileFolder->shortUrl)
6) You need to edit the javascript of the lateral menu to make the "share folder" link work with the new url. I added the hash in the title attribute and replaced the $('#nodeId').val() to $('#nodeTitle').val() in the javascript. To add the hash in the title, edit the /core/page/ajax/_account_home_v2_folder_listing.ajax.php and replace 'title'=>'' with 'title'=>bin2hex($row['shortUrl']) in the end of the file. Remember to alter the query and add shortUrl. It should start with $rows = $db->getRows('SELECT id, folderName, shortUrl
I guess that's it. I can't post the full files here because my script is completely different from the original yetishare and the files will not work with other installations.
Note that I'm using a field binary(8) instead of a char(16). And numeric field would work as well. This method makes the storage and the indexes 50% smaller. Small indexes have a huge impact on performance. I recommend using this method in all hashes in the script.