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(); } //loop through the users in the project foreach ($users as $user) { if (!empty($user["email"])) { $userlang = readLangfile($user['locale']); // check if subfolder exists, else root folder $whichfolder = !empty($thefolder) ? $thefolder : $userlang["rootdir"]; // assemble content only once. no need to do this repeatedly $mailcontent = $userlang["hello"] . ",<br /><br/>" . $userlang["filecreatedtext"] . "<br /><br />" . $userlang["project"] . ": " . $pname["name"] . "<br />" . $userlang["folder"] . ": " . $whichfolder . "<br />" . $userlang["file"] . ": <a href = \"" . $url . "managefile.php?action=downloadfile&file=" . $fileprops["ID"] . "\">" . $url . "managefile.php?action=downloadfile&file=" . $fileprops["ID"] . "</a>"; //$userlang["file"] . ": <a href = \"" . $url . $fileprops["datei"] . "\">" . $url . $fileprops["datei"] . "</a>"; $subject = $userlang["filecreatedsubject"] . " (" . $userlang['by'] . ' ' . $username . ")"; //if sendto is an array multiple users need to be notified if (is_array($sendto)) {
// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated), // MBOX, OPML, ATOM, ATOM0.3, HTML, JS echo $rss->saveFeed("RSS2.0", CL_ROOT . "/files/" . CL_CONFIG . "/ics/feedtask-{$user}.xml"); } elseif ($action == "mymsgs-rss") { $tproject = new project(); $myprojects = $tproject->getMyProjects($user); $msg = new message(); $messages = array(); foreach ($myprojects as $proj) { $message = $msg->getProjectMessages($proj["ID"]); if (!empty($message)) { array_push($messages, $message); } } if (!empty($messages)) { $messages = reduceArray($messages); } $strpro = $langfile["project"]; $tit = $langfile["mymessages"]; $rss->title = $tit; $rss->description = ""; $rss->descriptionHtmlSyndicated = true; $loc = $url . "managemessage.php?action=mymsgs"; $rss->link = $loc; $rss->syndicationURL = $loc; foreach ($messages as $message) { $item = new FeedItem(); $item->title = $message["title"]; $loc = $url . "managemessage.php?action=showmessage&mid={$message['ID']}&id={$message['project']}"; $item->link = $loc; $item->source = $loc;
} $myClosedProjects = $project->getMyProjects($userid, 0); // If the user is allowed to add projects, also get all users to assign to those projects if ($userpermissions["projects"]["add"]) { $user = new user(); $users = $user->getAllUsers(1000000); $template->assign("users", $users); $company = new company(); $companies = $company->getAllCompanies(); $template->assign("customers", $companies); } // by default the arrays have a level for each project, whcih contains arrays for each message/task . reduce array flattens this to have all messages/tasks of all projects in one structure if (!empty($messages)) { $messages = reduceArray($messages); } $etasks = reduceArray($tasks); // Create sort array for multisort by adding the daysleft value to a sort array $sort = array(); foreach ($etasks as $etask) { array_push($sort, $etask["daysleft"]); } // Sort using array_multisort array_multisort($sort, SORT_NUMERIC, SORT_ASC, $etasks); // On Admin Login check for updates $mode = getArrayVal($_GET, "mode"); if ($mode == "login") { $chkLim = 0; // only check if an admin logs in if ($userpermissions["admin"]["add"]) { // only check 1/2 of the times an admin logs in, to reduce server load $chkLim = mt_rand(1, 2);
/** * Export all tasks of a user via iCal * * @param int $user User ID * @param bool $show_long * @return bool */ function getIcal($user, $show_long = true) { $user = (int) $user; $show_long = (bool) $show_long; $username = $_SESSION["username"]; $project = new project(); $myprojects = $project->getMyProjects($user); $tasks = array(); if (!empty($myprojects)) { foreach ($myprojects as $proj) { $task = $this->getAllMyProjectTasks($proj["ID"], 10000); if (!empty($task)) { array_push($tasks, $task); } } } $etasks = reduceArray($tasks); require "class.ical.php"; $heute = date("d-m-y"); $cal = new vcalendar(); $fname = "tasks_" . $username . ".ics"; $cal->setConfig('directory', CL_ROOT . '/files/' . CL_CONFIG . '/ics'); $cal->setConfig('filename', $fname); $cal->setConfig('unique_id', ''); $cal->setProperty('X-WR-CALNAME', "Collabtive Aufgaben für " . $username); $cal->setProperty('X-WR-CALDESC', ''); $cal->setProperty('CALSCALE', 'GREGORIAN'); $cal->setProperty('METHOD', 'PUBLISH'); foreach ($etasks as $etask) { // split date in Y / M / D / h / min / sek variables $jahr = date("Y", $etask["start"]); $monat = date("m", $etask["start"]); $tag = date("d", $etask["start"]); $std = date("h", $etask["start"]); $min = date("i", $etask["start"]); $sek = date("s", $etask["start"]); // split date in Y / M / D / h / min / sek variables $ejahr = date("Y", $etask['end']); $emonat = date("m", $etask['end']); $etag = date("d", $etask['end']); $estd = date("h", $etask['end']); $emin = date("i", $etask['end']); $esek = date("s", $etask['end']); $e = new vevent(); $e->setProperty('categories', $etask['list']); if ($show_long) { // if we have a task lasting 10 month, normally it will be displayed every day within this time span. $e->setProperty('dtstart', $jahr, $monat, $tag, $std, $min); // 24 dec 2007 19.30 } else { // if the show_long flag is set, it will only be shown at the due date $e->setProperty('dtstart', $ejahr, $emonat, $etag, $estd, $emin); } $e->setProperty('due', $ejahr, $emonat, $etag, $estd, $emin); // 24 dec 2007 19.30 $e->setProperty('dtend', $ejahr, $emonat, $etag, $estd, $emin); $e->setProperty('description', $etask["text"]); $e->setProperty('status', "NEEDS-ACTION"); // $e->setProperty('comment' , $etask[text]); $e->setProperty('summary', $etask["title"]); $e->setProperty('location', 'Work'); $cal->setComponent($e); } $cal->returnCalendar(); return true; }