function export_wiki_pg_logs($project, $span, $who, $sf) { $eol = "\n"; $sql_wiki_pg = wiki_logs_extract($project, $span, $who); $col_list_wiki_pg = array('time', 'user', 'email', 'title', 'local_time'); $wiki_pg_title = array('time' => $GLOBALS['Language']->getText('project_stats_source_code_access_utils', 'wiki_access'), 'user' => '', 'email' => '', 'title' => '', 'local_time' => ''); $lbl_list_wiki_pg = array('time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'time'), 'user' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'user'), 'email' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'email'), 'title' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'page'), 'local_time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'local_time')); $result_wiki_pg = db_query($sql_wiki_pg); $rows_wiki_pg = db_numrows($result_wiki_pg); if (!$sf) { if ($result_wiki_pg && $rows_wiki_pg > 0) { // Build csv for wiki pages access logs echo build_csv_header($col_list_wiki_pg, $wiki_pg_title) . $eol; echo build_csv_header($col_list_wiki_pg, $lbl_list_wiki_pg) . $eol; while ($arr_wiki_pg = db_fetch_array($result_wiki_pg)) { prepare_access_logs_record($project->getGroupId(), $arr_wiki_pg); echo build_csv_record($col_list_wiki_pg, $arr_wiki_pg) . $eol; } echo build_csv_header($col_list_wiki_pg, array()) . $eol; } } else { //to be used in 'Show Format' link if ($result_wiki_pg && $rows_wiki_pg > 0) { $dsc_list = array('time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'date_desc'), 'user' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'user_desc'), 'email' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'email_desc'), 'title' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'page_desc'), 'local_time' => $GLOBALS['Language']->getText('project_export_access_logs_export', 'local_time_desc')); $record = pick_a_record_at_random($result_wiki_pg, $rows_wiki_pg, $col_list_wiki_pg); prepare_access_logs_record($project->getGroupId(), $record); display_exported_fields($col_list_wiki_pg, $lbl_list_wiki_pg, $dsc_list, $record); } } }
} else { project_admin_header(array('title' => $pg_title)); echo '<h3>' . $Language->getText('project_export_artifact_history_export', 'art_hist_export') . '</h3>'; if ($result) { echo '<P>' . $Language->getText('project_export_artifact_history_export', 'no_hist_found'); } else { echo '<P>' . $Language->getText('project_export_artifact_history_export', 'db_access_err', $GLOBALS['sys_name']); echo '<br>' . db_error(); } site_project_footer(array()); } } else { if ($export == "artifact_history_format") { echo '<h3>' . $Language->getText('project_export_artifact_history_export', 'hist_export_format') . '</h3>'; echo '<p>' . $Language->getText('project_export_artifact_history_export', 'hist_export_format_msg') . '</p>'; $record = pick_a_record_at_random($result, $rows, $col_list); prepare_artifact_history_record($at, $art_field_fact, $record); display_exported_fields($col_list, $lbl_list, $dsc_list, $record); } else { if ($export == "project_db") { // make sure the database name is not the same as the // Codendi database name !!!! if ($dbname != $sys_dbname) { // Get the artfact type list $at_arr = $atf->getArtifactTypes(true); if ($at_arr && count($at_arr) >= 1) { for ($j = 0; $j < count($at_arr); $j++) { $tbl_name = "artifact_history_" . $at_arr[$j]->getItemName(); $tbl_name = str_replace(' ', '_', $tbl_name); $atid = $at_arr[$j]->getID(); // Create the ArtifactType object
/** * Display screen showing the allowed input format of the CSV files * * */ function displayShowFormat() { global $Language; // project_export_utils is using $at instead of $ath $at = $this->ath; $this->ath->header(array('title' => $Language->getText('tracker_import', 'art_import') . ' ' . $this->ath->getID() . ' - ' . $this->ath->getName(), 'pagename' => 'tracker', 'atid' => $this->ath->getID(), 'sectionvals' => array($this->group->getPublicName()), 'help' => 'tracker-v3.html#tracker-artifact-import')); echo '<div id="tracker_toolbar_clear"></div>' . PHP_EOL; $sql = $this->ath->buildExportQuery($fields, $col_list, $this->lbl_list, $this->dsc_list, $select, $from, $where, $multiple_queries, $all_queries); //we need only one single record $sql .= " LIMIT 1"; //get all mandatory fields $mand_list = $this->mandatoryFields(); // Add the 2 fields that we build ourselves for user convenience // - All follow-up comments // - Dependencies $col_list[] = 'follow_ups'; $col_list[] = 'is_dependent_on'; $col_list[] = 'add_cc'; $col_list[] = 'cc_comment'; $eol = "\n"; $result = db_query($sql); $rows = db_numrows($result); echo '<h3>' . $Language->getText('tracker_import', 'format_hdr'), '</h3>'; echo '<p>' . $Language->getText('tracker_import', 'format_msg'), '<p>'; if ($rows > 0) { $record = pick_a_record_at_random($result, $rows, $col_list); } else { $record = $this->ath->buildDefaultRecord(); } prepare_artifact_record($at, $fields, $this->ath->getId(), $record, 'csv'); $hp = Codendi_HTMLPurifier::instance(); foreach ($record as $k => $v) { //We should know the type of each field because some are sanitized, others htmlspecialcharized... $record[$k] = $hp->purify($v, CODENDI_PURIFIER_CONVERT_HTML); } display_exported_fields($col_list, $this->lbl_list, $this->dsc_list, $record, $mand_list); echo '<br><br><h4>' . $Language->getText('tracker_import', 'sample_cvs_file') . '</h4>'; echo build_csv_header($col_list, $this->lbl_list); echo '<br>'; echo build_csv_record($col_list, $record); $this->ath->footer(array()); }