function in_archiv ($sem_id) { global $SEM_CLASS,$SEM_TYPE, $ARCHIV_PATH, $TMP_PATH, $ZIP_PATH, $ZIP_OPTIONS, $_fullname_sql; NotificationCenter::postNotification('CourseWillArchive', $sem_id); //Besorgen der Grunddaten des Seminars $query = "SELECT Seminar_id, Name, Untertitel, Beschreibung, start_time, Institut_id, status FROM seminare WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $row = $statement->fetch(PDO::FETCH_ASSOC); $seminar_id = $row['Seminar_id']; $name = $row['Name']; $untertitel = $row['Untertitel']; $beschreibung = $row['Beschreibung']; $start_time = $row['start_time']; $heimat_inst_id = $row['Institut_id']; //Besorgen von einzelnen Daten zu dem Seminar $semester = new SemesterData; $all_semester = $semester->getAllSemesterData(); foreach ($all_semester as $sem) { if (($start_time >= $sem['beginn']) && ($start_time <= $sem['ende'])) { $semester_tmp = $sem['name']; } } //Studienbereiche if ($SEM_CLASS[$SEM_TYPE[$row['status']]['class']]['bereiche']) { $sem_path = get_sem_tree_path($seminar_id); if (is_array($sem_path)) { $studienbereiche = join(', ', $sem_path); } } // das Heimatinstitut als erstes $query = "SELECT Name FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($heimat_inst_id)); $institute = $statement->fetchColumn(); // jetzt den Rest $query = "SELECT Name FROM Institute LEFT JOIN seminar_inst USING (institut_id) WHERE seminar_id = ? AND Institute.Institut_id != ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $heimat_inst_id)); while ($temp = $statement->fetchColumn()) { $institute .= ', ' . $temp; } $query = "SELECT GROUP_CONCAT({$_fullname_sql['full']} SEPARATOR ', ') FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE seminar_id = ? AND seminar_user.status = 'dozent'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $dozenten = $statement->fetchColumn(); $query = "SELECT fakultaets_id FROM seminare LEFT JOIN Institute USING (Institut_id) WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet_id = $statement->fetchColumn(); $query = "SELECT GROUP_CONCAT(DISTINCT c.Name SEPARATOR ' | ') FROM seminar_inst AS a LEFT JOIN Institute AS b USING (Institut_id) LEFT JOIN Institute AS c ON (c.Institut_id = b.fakultaets_id) WHERE a.seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet = $statement->fetchColumn(); setTempLanguage(); // use $DEFAULT_LANGUAGE for archiv-dumps //Dump holen $dump = dump_sem($sem_id, 'nobody'); //Forumdump holen foreach (PluginEngine::getPlugins('ForumModule', $sem_id) as $plugin) { $forumdump .= $plugin->getDump($sem_id); } // Wikidump holen $wikidump = getAllWikiPages($sem_id, $name, FALSE); restoreLanguage(); //OK, naechster Schritt: Kopieren der Personendaten aus seminar_user in archiv_user $query = "INSERT INTO archiv_user (seminar_id, user_id, status) SELECT Seminar_id, user_id, status FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); // Eventuelle Vertretungen in der Veranstaltung haben weiterhin Zugriff mit Dozentenrechten if (get_config('DEPUTIES_ENABLE')) { $deputies = getDeputies($seminar_id); // Eintragen ins Archiv mit Zugriffsberechtigung "dozent" $query = "INSERT IGNORE INTO archiv_user SET seminar_id = ?, user_id = ?, status = 'dozent'"; $statement = DBManager::get()->prepare($query); foreach ($deputies as $deputy) { $statement->execute(array($seminar_id, $deputy['user_id'])); } } $Modules = new Modules; $Modules = $Modules->getLocalModules($sem_id); $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $sem_id,'entity_type' => 'sem')); if ($Modules['documents_folder_permissions'] || StudipDocumentTree::ExistsGroupFolders($sem_id)) { $unreadable_folders = $folder_tree->getUnReadableFolders('nobody'); } $query = "SELECT COUNT(dokument_id) FROM dokumente WHERE seminar_id = ? AND url = ''"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $count = $statement->fetchColumn(); if ($count) { $hash_secret = "frauen"; $archiv_file_id = md5(uniqid($hash_secret,1)); //temporaeres Verzeichnis anlegen $tmp_full_path = "$TMP_PATH/$archiv_file_id"; mkdir($tmp_full_path, 0700); if($folder_tree->getNumKids('root')) { $list = $folder_tree->getKids('root'); } if (is_array($list) && count($list) > 0) { $query = "SELECT folder_id, name FROM folder WHERE range_id IN (?) ORDER BY name"; $statement = DBManager::get()->prepare($query); $statement->execute(array($list)); $folder = 0; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $folder += 1; $temp_folder = $tmp_full_path . "/[$folder]_" . prepareFilename($row['name'], FALSE); mkdir($temp_folder, 0700); createTempFolder($row['folder_id'], $temp_folder, $seminar_id, 'nobody'); } //zip all the stuff $archiv_full_path = "$ARCHIV_PATH/$archiv_file_id"; create_zip_from_directory($tmp_full_path, $tmp_full_path); @rename($tmp_full_path . '.zip', $archiv_full_path); } rmdirr($tmp_full_path); if (is_array($unreadable_folders)) { $query = "SELECT dokument_id FROM dokumente WHERE seminar_id = ? AND url = '' AND range_id IN (?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $unreadable_folders)); $archiv_protected_file_id = createSelectedZip($statement->fetchAll(PDO::FETCH_COLUMN), false, false); @rename("$TMP_PATH/$archiv_protected_file_id", "$ARCHIV_PATH/$archiv_protected_file_id"); } } else { $archiv_file_id = ''; } //Reinschreiben von diversem Klumpatsch in die Datenbank $query = "INSERT INTO archiv (seminar_id, name, untertitel, beschreibung, start_time, semester, heimat_inst_id, institute, dozenten, fakultaet, dump, archiv_file_id,archiv_protected_file_id, forumdump, wikidump, studienbereiche, mkdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP())"; $statement = DBManager::get()->prepare($query); $success = $statement->execute(array( $seminar_id, $name ?: '', $untertitel ?: '', $beschreibung ?: '', $start_time, $semester_tmp ?: '', $heimat_inst_id, $institute ?: '', $dozenten ?: '', $fakultaet ?: '', $dump ?: '', $archiv_file_id ?: '', $archiv_protected_file_id ?: '', $forumdump ?: '', $wikidump ?: '', $studienbereiche ?: '', )); if ($success) { NotificationCenter::postNotification('CourseDidArchive', $seminar_id); } }
case 6: $path_file = getLinkPath($file_id); break; //we want to download a file attached to a system message (this mode performs perm checks) //we want to download a file attached to a system message (this mode performs perm checks) case 7: $path_file = get_upload_file_path($file_id); break; //we want to download from the regular upload-folder (this mode performs perm checks) //we want to download from the regular upload-folder (this mode performs perm checks) default: $path_file = get_upload_file_path($file_id); break; } //replace bad charakters to avoid problems when saving the file $file_name = prepareFilename(basename(Request::get('file_name'))); if (Request::int('zip') && is_file($path_file)) { $tmp_id = md5(uniqid("suppe")); $zip_path_file = "{$TMP_PATH}/{$tmp_id}"; $tmp_file_name = escapeshellcmd("{$TMP_PATH}/{$file_name}"); @copy($path_file, $tmp_file_name); if (create_zip_from_file($tmp_file_name, "{$zip_path_file}.zip") === false) { @unlink($zip_path_file . '.zip'); @unlink($tmp_file_name); throw new Exception(_("Fehler beim Erstellen des Zip-Archivs!")); } else { $file_name = $file_name . ".zip"; $path_file = $zip_path_file . ".zip"; @unlink($tmp_file_name); } }
if (Request::get('details')) { $_SESSION['_user_activities']['details'] = Request::option('details'); } if (Request::get('open')) { $_SESSION['_user_activities']['open'][Request::get('open')] = time(); } if (Request::get('close')) { unset($_SESSION['_user_activities']['open'][Request::get('close')]); } $user_id = get_userid($_SESSION['_user_activities']['username']); arsort($_SESSION['_user_activities']['open'], SORT_NUMERIC); if (Request::get('download_as_zip')) { $download_ids = Request::quoted('download_as_zip') == 'all' ? get_user_documents($user_id) : get_user_documents($user_id, Request::quoted('download_as_zip')); if (is_array($download_ids) && count($download_ids)) { $zip_file_id = createSelectedZip($download_ids, false); $zip_name = prepareFilename($_SESSION['_user_activities']['username'] . '-' . _("Dokumente") . '.zip'); header('Location: ' . getDownloadLink($zip_file_id, $zip_name, 4)); page_close(); die; } } reset($_SESSION['_user_activities']['open']); $ank = key($_SESSION['_user_activities']['open']); // Define structure of displayed information $queries[] = array('desc' => _('Eingetragen in Veranstaltungen (dozent / tutor / autor / user)'), 'query' => "SELECT CONCAT_WS(' / ', SUM(status = 'dozent'), SUM(status = 'tutor'),\n SUM(status = 'autor'), SUM(status = 'user'))\n FROM seminar_user\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar"); $queries[] = array('desc' => _('Eingetragen in geschlossenen Veranstaltungen (dozent / tutor / autor / user)'), 'query' => "SELECT CONCAT_WS(' / ', SUM(su.status = 'dozent'), SUM(su.status = 'tutor'),\n SUM(su.status = 'autor'), SUM(su.status = 'user'))\n FROM seminar_user AS su\n INNER JOIN seminar_courseset sc USING (seminar_id)\n INNER JOIN courseset_rule cr ON cr.set_id=sc.set_id AND cr.type='ParticipantRestrictedAdmission'\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_closed"); $queries[] = array('desc' => _("Eingetragen in Wartelisten (wartend / vorläufig akzeptiert)"), 'query' => "SELECT CONCAT_WS(' / ', SUM(status = 'awaiting'), SUM(status = 'accepted'))\n FROM admission_seminar_user\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_wait"); $queries[] = array('desc' => _("Eingetragen in Anmeldelisten"), 'query' => "SELECT COUNT(*)\n FROM priorities\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_claiming"); $queries[] = array('desc' => _("Eingetragen in Einrichtungen (admin / dozent / tutor / autor)"), 'query' => "SELECT CONCAT_WS(' / ', SUM(inst_perms = 'admin'), SUM(inst_perms = 'dozent'),\n SUM(inst_perms = 'tutor'), SUM(inst_perms = 'autor'))\n FROM user_inst\n WHERE user_id = ?\n GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Ankündigungen"), 'query' => "SELECT COUNT(*) FROM news WHERE user_id = ? GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Wikiseiten"), 'query' => "SELECT COUNT(*) FROM wiki WHERE user_id = ? GROUP BY user_id");
/** * Erzeugt einen Downloadlink abhaengig von der Konfiguration des Systems * (Config::get()->SENDFILE_LINK_MODE = 'normal'|'old'|'rewrite') * * @param string $file_id * @param string $file_name * @param integer $type sendfile type 1,2,3,4,5 or 6 * @param string $dltype 'normal', 'zip' or 'force' (or 'force_download') * @return string downloadlink */ function GetDownloadLink($file_id, $file_name, $type = 0, $dltype = 'normal', $range_id = '', $list_id = ''){ $mode = Config::get()->SENDFILE_LINK_MODE ?: 'normal'; $link[] = $GLOBALS['ABSOLUTE_URI_STUDIP']; $wa = ''; switch($mode) { case 'rewrite': $link[] = 'download/'; switch ($dltype) { case 'zip': $link[] = 'zip/'; break; case 'force': case 'force_download': $link[] = 'force_download/'; break; case 'normal': default: $link[] = 'normal/'; } $link[] = $type . '/'; if ($type == 5) { $link[] = rawurlencode($range_id) . '/' . rawurlencode($list_id); } else { $link[] = rawurlencode(prepareFilename($file_id)); } $link[] = '/' . rawurlencode(prepareFilename($file_name)); break; case 'old': // workaround for old browser (IE) $wa = '/'; case 'normal': default: $link[] = 'sendfile.php?' . $wa; if ($dltype == 'zip'){ $link[] = 'zip=1&'; } elseif ($dltype == 'force_download' || $dltype == 'force') { $link[] = 'force_download=1&'; } $link[] = 'type='.$type; if ($type == 5) { $link[] = '&range_id=' . rawurlencode($range_id) . '&list_id=' . rawurlencode($list_id); } else { $link[] = '&file_id=' . rawurlencode(prepareFilename($file_id)); } $link[] = '&file_name=' . rawurlencode(prepareFilename($file_name )); } return implode('', $link); }
public function export_action() { $course = new Course($_SESSION['SessionSeminar']); $sem = new Seminar($_SESSION['SessionSeminar']); $themen =& $sem->getIssues(); $termine = getAllSortedSingleDates($sem); $dates = array(); if (is_array($termine) && sizeof($termine) > 0) { foreach ($termine as $singledate_id => $singledate) { if (!$singledate->isExTermin()) { $tmp_ids = $singledate->getIssueIDs(); $title = $description = ''; if (is_array($tmp_ids)) { $title = trim(join("\n", array_map(function ($tid) use($themen) { return $themen[$tid]->getTitle(); }, $tmp_ids))); $description = trim(join("\n\n", array_map(function ($tid) use($themen) { return $themen[$tid]->getDescription(); }, $tmp_ids))); } $dates[] = array('date' => $singledate->toString(), 'title' => $title, 'description' => $description, 'start' => $singledate->getStartTime(), 'related_persons' => $singledate->getRelatedPersons()); } elseif ($singledate->getComment()) { $dates[] = array('date' => $singledate->toString(), 'title' => _('fällt aus') . ' (' . _('Kommentar:') . ' ' . $singledate->getComment() . ')', 'description' => '', 'start' => $singledate->getStartTime(), 'related_persons' => array()); } } } $factory = $this->get_template_factory(); $template = $factory->open($this->get_default_template("export")); $template->set_attribute('dates', $dates); $content = $template->render(); $content = mb_encode_numericentity($content, array(0x80, 0xffff, 0, 0xffff), 'cp1252'); $filename = prepareFilename($course['name'] . '-' . _("Ablaufplan")) . '.doc'; $this->set_content_type(get_mime_type($filename)); $this->response->add_header('Content-Disposition', 'attachment;filename="' . $filename . '"'); $this->response->add_header('Expires', 0); $this->response->add_header('Cache-Control', 'private'); $this->response->add_header('Pragma', 'cache'); $this->render_text($content); }
$zip_file_id = createSelectedZip($download_ids, true, true); if($zip_file_id){ $zip_name = prepareFilename($SessSemName[0].'-'._("Neue Dokumente").'.zip'); header('Location: ' . getDownloadLink( $zip_file_id, $zip_name, 4)); page_close(); die; } } } if (Request::submitted('download_selected')) { $download_ids = Request::optionArray('download_ids'); if (count($download_ids) > 0) { $zip_file_id = createSelectedZip($download_ids, true, true); if($zip_file_id){ $zip_name = prepareFilename($SessSemName[0].'-'._("Dokumente").'.zip'); header('Location: ' . getDownloadLink( $zip_file_id, $zip_name, 4)); page_close(); die; } } } // add skip links SkipLinks::addIndex(Navigation::getItem('/course/files/all')->getTitle(), 'main_content', 100); SkipLinks::addIndex(Navigation::getItem('/course/files/tree')->getTitle(), 'main_content', 100); $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $SessSemName[1])); $question = $msg = ''; if($zip_file_id === false){
case 'abba': $rowsABBA = array(); foreach ($rowsKeys as $k => $row) { $tab = explode(' | ', $row['ga:eventLabel']); /** variant */ $abba_label = $tab[0]; /** views | goals */ $action_type = $tab[1]; switch ($action_type) { case 'views': $rowsABBA[$abba_label]['number_of_trials'] = $row['ga:totalEvents']; break; case 'goal': $rowsABBA[$abba_label]['number_of_successes'] = $row['ga:totalEvents']; break; default: break; } } $abba = array('config' => array('intervalConfidenceLevel' => $config['intervalConfidenceLevel'], 'multipleTestingCorrection' => $config['multipleTestingCorrection'])); $abba['data'] = $rowsABBA; $json = json_encode($abba); $filename = prepareFilename($configFile, $config['outputFormat']); if (saveJSON($filename, $config['outputDirectory'], $json)) { echo info("Saved to file " . $filename . "\n"); } break; default: echo error("Unknown output format\n"); break; }