if ($absfolder == "/") { $absfolder = ""; } $thefolder = $thefolder["name"]; $upath = "files/" . CL_CONFIG . "/{$id}" . $absfolder; } else { $upath = "files/" . CL_CONFIG . "/{$id}"; $upfolder = 0; } //how many files to upload $num = count($_FILES); $chk = 0; //Loop through uploaded files foreach ($_FILES as $file) { //encrypt files in their tmp location $myfile->encryptFile($file["tmp_name"], $settings["filePass"]); //upload them to the files folder and add to the database $fid = $myfile->uploadAsync($file["name"], $file["tmp_name"], $file["type"], $file["size"], $upath, $id, $upfolder); //get the new file object $fileprops = $myfile->getFile($fid); //send mail notifications if ($settings["mailnotify"]) { $sendto = getArrayVal($_POST, "sendto"); $usr = (object) new project(); $pname = $usr->getProject($id); $users = $usr->getProjectMembers($id, 10000); if ($sendto[0] == "all") { $sendto = $users; $sendto = reduceArray($sendto); } elseif ($sendto[0] == "none") { $sendto = array();
//turn the array into a string } $filePass = randomPassword(); $path = "./include/phpseclib"; set_include_path(get_include_path() . PATH_SEPARATOR . $path); $conn->query("CREATE TABLE IF NOT EXISTS `customers_assigned` (\n `ID` int(10) NOT NULL AUTO_INCREMENT,\n `customer` int(10) NOT NULL,\n `project` int(10) NOT NULL,\n PRIMARY KEY (`ID`),\n UNIQUE KEY `ID` (`ID`)\n)"); $oldTemplate = $settings["template"]; $template->assign("theme", $oldTemplate); $conn->query("INSERT INTO `settings` (`ID` ,`settingsKey` ,`settingsValue`) VALUES (NULL , 'theme', '{$oldTemplate}')"); $conn->query("UPDATE `settings` SET `template`='standard'"); $conn->query("INSERT INTO `settings` (`ID`, `settingsKey`, `settingsValue`) VALUES (NULL, 'filePass', '{$filePass}')"); $filesList = $conn->query("SELECT * FROM `files`")->fetchAll(); $fileObj = new datei(); foreach ($filesList as $file) { $tmpFile = CL_ROOT . "/" . $file["datei"]; $fileObj->encryptFile($tmpFile, $filePass); } //drop tags field from files $conn->query("ALTER TABLE `files` DROP `tags`"); // VERSION-INDEPENDENT // Clear templates cache $handle = opendir($template->compile_dir); while (false !== ($file = readdir($handle))) { if ($file != "." and $file != "..") { unlink(CL_ROOT . "/" . $template->compile_dir . "/" . $file); } } // Optimize tables $opt1 = $conn->query("OPTIMIZE TABLE `files`"); $opt2 = $conn->query("OPTIMIZE TABLE `files_attached`"); $opt3 = $conn->query("OPTIMIZE TABLE `log`");