<?php

$relPath = "./../../pinc/";
include_once $relPath . 'base.inc';
include_once $relPath . 'wordcheck_engine.inc';
include_once $relPath . 'Project.inc';
include_once $relPath . 'theme.inc';
include_once './post_files.inc';
include_once "./word_freq_table.inc";
require_login();
$datetime_format = "%A, %B %e, %Y %X";
set_time_limit(0);
// no time limit
$projectid = validate_projectID('projectid', @$_REQUEST['projectid']);
$fileObject = get_project_word_file($projectid, "good");
$timeCutoff = get_integer_param($_REQUEST, 'timeCutoff', $fileObject->mod_time, 0, null);
$freqCutoff = get_integer_param($_REQUEST, 'freqCutoff', 5, 0, null);
enforce_edit_authorization($projectid);
if ($timeCutoff == 0) {
    $time_cutoff_text = _("<b>All proofreader suggestions</b> are included in the results.");
} else {
    $time_cutoff_text = sprintf(_("Only proofreader suggestions made <b>after %s</b> are included in the results."), strftime($datetime_format, $timeCutoff));
}
// $format determines what is presented from this page:
//   'html' - page is rendered with frequencies included
//   'file' - all words and frequencies are presented as a
//            downloaded file
// 'update' - update the list
$format = get_enumerated_param($_REQUEST, 'format', 'html', array('html', 'file', 'update'));
if ($format == "update") {
    $postedWords = parse_posted_words($_POST);
示例#2
0
function is_an_extra_file($filename)
{
    global $project;
    static $excluded_filenames = NULL;
    if (is_null($excluded_filenames)) {
        $excluded_filenames = array();
        // A small set of filenames that we know a priori
        // will be excluded if they occur.
        // These appear at "Word Lists":
        foreach (array('good', 'bad') as $code) {
            $f = get_project_word_file($project->projectid, $code);
            $excluded_filenames[$f->filename] = 1;
        }
        // These three appear under "Post Downloads":
        $excluded_filenames[$project->projectid . 'images.zip'] = 1;
        $excluded_filenames[$project->projectid . '.zip'] = 1;
        $excluded_filenames[$project->projectid . '_TEI.zip'] = 1;
        // should really exclude uploaded SR, PP and PPV files too,
        // but we can't just add them to excluded_filenames because we
        // don't know their names in advance
    }
    if (array_key_exists($filename, $excluded_filenames)) {
        return FALSE;
    }
    // Exclude all images (both page-images and non-page-images).
    $image_extensions = array('png', 'jpg');
    $extension = pathinfo($filename, PATHINFO_EXTENSION);
    if (in_array($extension, $image_extensions)) {
        return FALSE;
    }
    return TRUE;
}
示例#3
0
 echo "</td>\n";
 // Options
 if ($show_options_column) {
     echo "<td align=center>";
     if (user_is_a_sitemanager() || user_is_proj_facilitator() || $project->username == $pguser) {
         echo _("Edit") . ":";
         echo " ";
         echo "<a href=\"editproject.php?action=edit&project={$projectid}\">" . _("Info") . "</a>";
         echo " | ";
         echo "<a href=\"edit_project_word_lists.php?projectid={$projectid}\">" . _("Word&nbsp;Lists") . "</a>";
         // Should we show an "attention" icon?
         // Currently, we only do this if suggestions have been added since
         // the Good Words file was last modified.
         // In future, there might be various reasons to do so.
         // (But then what would we put in the tooltip?)
         $f_g = get_project_word_file($projectid, 'good');
         $count = count_wordcheck_suggestion_events($projectid, $f_g->mod_time);
         if ($count >= 1) {
             $tooltip = attr_safe(_('"Suggestions from proofreaders" list has changed; click here to view'));
             echo " <a href='{$code_url}/tools/project_manager/show_good_word_suggestions.php?projectid={$projectid}' target='_blank'>";
             echo "<img src='{$code_url}/graphics/exclamation.gif' title='{$tooltip}' border='0'>";
             echo "</a>";
         }
         echo "<br>";
     }
     if ($user_can_see_download_links) {
         if ($project->state == PROJ_POST_FIRST_UNAVAILABLE || $project->state == PROJ_POST_FIRST_AVAILABLE || $project->state == PROJ_POST_FIRST_CHECKED_OUT) {
             echo " <a href=\"{$projects_url}/{$projectid}/{$projectid}.zip\">", _("D/L"), "</a>";
         }
         if ($project->state == PROJ_POST_SECOND_CHECKED_OUT || $project->state == PROJ_POST_COMPLETE) {
             echo " <a href=\"{$projects_url}/{$projectid}/" . $projectid . "_second.zip\">", _("D/L"), "</a>";
 function save_to_files()
 {
     $good_word_conflict = $bad_word_conflict = false;
     $messages = array();
     // first, check to see if the good or bad word list
     // has changed out from beneath us
     $gwl_object = get_project_word_file($this->projectid, "good");
     $bwl_object = get_project_word_file($this->projectid, "bad");
     $current_gwl_timestamp = $gwl_object->mod_time;
     $current_bwl_timestamp = $bwl_object->mod_time;
     if ($current_gwl_timestamp != $this->gwl_timestamp) {
         // TRANSLATORS: %s is a link to the Good Word List
         $error = sprintf(_("The Good Words List was changed by another process during your edit session. Your changes to this list have not been saved to prevent data loss. View the %s and merge your changes manually. If you want the superset of both lists, simply append the contents of the Good Words List to that within the Good Words edit box below - the server will remove any duplicates. Saving this page again will override this message."), new_window_link($gwl_object->abs_url, _("Good Words List")));
         $this->gwl_timestamp = $current_gwl_timestamp;
         array_push($messages, $error);
         $good_word_conflict = true;
     } else {
         // everything looks good, save the changes
         $good_words = explode("[lf]", str_replace(array("\r", "\n"), array('', "[lf]"), $this->good_words));
         save_project_good_words($this->projectid, $good_words);
     }
     if ($current_bwl_timestamp != $this->bwl_timestamp) {
         // TRANSLATORS: %s is a link to the Bad Word List
         $error = sprintf(_("The Bad Words List was changed by another process during your edit session. Your changes to this list have not been saved to prevent data loss. View the %s and merge your changes manually. If you want the superset of both lists, simply append the contents of the Bad Words List to that within the Bad Words edit box below - the server will remove any duplicates. Saving this page again will override this message."), new_window_link($bwl_object->abs_url, _("Bad Words List")));
         $this->bwl_timestamp = $current_bwl_timestamp;
         array_push($messages, $error);
         $bad_word_conflict = true;
     } else {
         // everything looks good, save the changes
         $bad_words = explode("[lf]", str_replace(array("\r", "\n"), array('', "[lf]"), $this->bad_words));
         save_project_bad_words($this->projectid, $bad_words);
     }
     return array($good_word_conflict, $bad_word_conflict, $messages);
 }