} if ($action == "upload") { $num = $_POST['numfiles']; if ($upfolder) { $thefolder = $myfile->getFolder($upfolder); $thefolder = $thefolder["name"]; $upath = "files/" . CL_CONFIG . "/$id/" . $thefolder; } else { $upath = "files/" . CL_CONFIG . "/$id"; $upfolder = 0; } $chk = 0; for($i = 1;$i <= $num;$i++) { $fid = $myfile->upload("userfile$i", $upath, $id, $upfolder); $fileprops = $myfile->getFile($fid); 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(); } foreach($users as $user) { if (!empty($user["email"])) {
$template->assign("mainclasses", $mainclasses); //check if the user is admin if (!$userpermissions["admin"]["add"]) { $errtxt = $langfile["nopermission"]; $noperm = $langfile["accessdenied"]; $template->assign("errortext", "$errtxt<br>$noperm"); $template->display("error.tpl"); } //basecamp import if ($action == "basecamp") { // create new file object $myfile = new datei(); // create new importer object $importer = new importer(); // upload the file $up = $myfile->upload("importfile", "files/" . CL_CONFIG . "/ics", 0); if ($up) { $importer->importBasecampXmlFile(CL_ROOT . "/files/" . CL_CONFIG . "/ics/$up"); } //delete the imported file unlink(CL_ROOT . "/files/" . CL_CONFIG . "/ics/$up"); $loc = $url . "admin.php?action=system&mode=imported&msg=$importer->msgCount&peop=$importer->peopleCount&pro=$importer->projectCount&tsk=$importer->taskCount"; header("Location: $loc"); } ?>
/** * Attach a file to a message * * @param int $fid ID of the file to be attached * @param int $mid ID of the message where the file will be attached * @param int $id optional param denoting the project ID where the file will be uploaded to (if so) * @return bool */ function attachFile($fid, $mid, $id = 0) { global $conn; $fid = (int) $fid; $mid = (int) $mid; $id = (int) $id; $myfile = new datei(); // If a file ID is given, the given file will be attached // If no file ID is given, the file will be uploaded to the project defined by $id and then attached if ($fid > 0) { $insStmt = $conn->prepare("INSERT INTO files_attached (file,message) VALUES (?,?)"); $insStmt->execute(array($fid, $mid)); } else { $num = $_POST["numfiles"]; $chk = 0; $insStmt = $conn->prepare("INSERT INTO files_attached (file,message) VALUES (?,?)"); for ($i = 1; $i <= $num; $i++) { $fid = $myfile->upload("userfile{$i}", "files/" . CL_CONFIG . "/{$id}", $id); $ins = $insStmt->execute(array($fid, $mid)); } } if ($ins) { return true; } else { return false; } }
function attachFile($fid, $mid, $id = 0) { $fid = (int) $fid; $mid = (int) $mid; $id = (int) $id; $myfile = new datei(); if ($fid > 0) { $ins = mysql_query("INSERT INTO files_attached (ID,file,message) VALUES ('',{$fid},{$mid})"); } else { $num = $_POST["numfiles"]; $chk = 0; for ($i = 1; $i <= $num; $i++) { $fid = $myfile->upload("userfile{$i}", "files/" . CL_CONFIG . "/{$id}", $id); $ins = mysql_query("INSERT INTO files_attached (ID,file,message) VALUES ('',{$fid},{$mid})"); } } if ($ins) { return true; } else { return false; } }