1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00
jappix_ynh/source/server/store-tree.php

53 lines
1,022 B
PHP
Raw Normal View History

2014-03-12 14:52:47 +01:00
<?php
/*
Jappix - An open social platform
This script (re)generates the store sub-folders (after an update)
-------------------------------------------------
License: AGPL
Authors: Valérian Saliou, regilero
*/
// Someone is trying to hack us?
if(!defined('JAPPIX_BASE')) {
exit;
}
// Array of the sub-folders to create
$store_folders = array(
'access',
'backgrounds',
'conf',
'logos',
'music',
'share',
'update'
);
// Creates the store sub-folders
for($i = 0; $i < count($store_folders); $i++) {
$current = JAPPIX_BASE.'/store/'.$store_folders[$i];
// Create the folder itself
if(!is_dir($current)) {
mkdir($current, 0777, true);
}
chmod($current, 0777);
// Create the security file inside the folder
$security_html = securityHTML();
file_put_contents($current.'/index.html', $security_html, LOCK_EX);
}
// Apply 777 rights on other writable folders
chmod(JAPPIX_BASE.'/log', 0777);
chmod(JAPPIX_BASE.'/tmp', 0777);
?>