include_once $relPath . 'Project.inc'; include_once './post_files.inc'; require_login(); $valid_round_ids = array_keys($Round_for_round_id_); array_unshift($valid_round_ids, '[OCR]'); if (@$_REQUEST['projectid'] == 'many') { $projectid = 'many'; } else { $projectid = validate_projectID('projectid', @$_REQUEST['projectid']); } $round_id = get_enumerated_param($_REQUEST, 'round_id', null, $valid_round_ids); $which_text = get_enumerated_param($_REQUEST, 'which_text', null, array('EQ', 'LE')); $include_proofers = get_integer_param($_REQUEST, 'include_proofers', 0, 0, 1); $save_files = get_integer_param($_REQUEST, 'save_files', 0, 0, 1); // only sitemanagers are allowed to save files if ($save_files && !user_is_a_sitemanager()) { echo _('You are not authorized to invoke this script.'); exit; } // only people who can see names on the page details page // can see names here. $project = new Project($projectid); if ($include_proofers && !$project->names_can_be_seen_by_current_user) { echo _('You are not authorized to invoke this script.'); exit; } // if we are not saving files, then we are just downloading the zip. // don't send anything out other than the headers and zip file contents. if ($save_files) { echo "projectid = '{$projectid}'<br>\n"; echo "round_id = '{$round_id}'<br>\n";
include_once $relPath . 'theme.inc'; include_once $relPath . 'js_newpophelp.inc'; include_once $relPath . 'metarefresh.inc'; include_once '../includes/team.inc'; require_login(); $theme_extra_args = array("js_data" => get_newHelpWin_javascript("{$code_url}/pophelp.php?category=teams&name=edit_")); // Either the parameter is $_POST['tsid'] when coming from the edit form, // or it is $_GET['tid'] when using the link on top of the team summary. $tid = get_integer_param($_POST, 'tsid', null, 1, null, true); if (!isset($tid)) { $tid = get_integer_param($_GET, 'tid', null, 1, null); } $result = select_from_teams("id = {$tid}"); $curTeam = mysql_fetch_assoc($result); // Allow team owner and site administrators to edit the team if ($userP['u_id'] != $curTeam['owner'] && !user_is_a_sitemanager()) { $title = _("Authorization Failed"); $desc = _("You are not authorized to edit this team...."); metarefresh(4, "tdetail.php?tid={$tid}", $title, $desc); exit; } if (isset($_GET['tid'])) { $edit = _("Edit"); output_header($edit . " " . $curTeam['teamname'], SHOW_STATSBAR, $theme_extra_args); echo "<center><br>"; showEdit(unstripAllString($curTeam['teamname'], 0), unstripAllString($curTeam['team_info'], 1), unstripAllString($curTeam['webpage'], 1), 0, $tid); echo "</center>"; } elseif (isset($_POST['edQuit'])) { $title = _("Quit Without Saving"); $desc = _("Quitting without saving..."); metarefresh(4, "tdetail.php?tid={$tid}", $title, $desc);
<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once $relPath . 'theme.inc'; include_once $relPath . 'user_is.inc'; require_login(); if (!user_is_a_sitemanager()) { die("You are not authorized to access this page."); } $title = _("Site Administration"); output_header($title); echo "<h1>{$title}</h1>"; echo "<p>" . _("This page provides access to site administration utilities.") . "</p>"; $pages = array("edit_mail_address_for_non_activated_user.php" => _("Send activation email for new user"), "manage_site_access_privileges.php" => _("Manage Site Access Privileges"), "manage_special_days.php" => _("Manage Special Days"), "sitenews.php" => _("Manage Site News"), "copy_pages.php" => _("Copy Pages from One Project to Another"), "rename_pages.php" => _("Rename pages"), "shared_postednums.php" => _("Detect duplicate postednum"), "displayrandrules.php" => _("Display Random Rules"), "manage_site_word_lists.php" => _("Manage site word lists"), "show_common_words_from_project_word_lists.php" => _("Show common words from project word lists")); echo "<ul>"; foreach ($pages as $page => $label) { echo "<li><a href='{$page}'>{$label}</a></li>"; } echo "</ul>"; // vim: sw=4 ts=4 expandtab
function user_may_access_all_upload_dirs() { return user_is_a_sitemanager(); }
include_once 'page_table.inc'; require_login(); $projectid = validate_projectID('project', @$_GET['project']); $show_image_size = get_integer_param($_GET, 'show_image_size', 0, 0, 1); $project = new Project($projectid); if (isset($_GET['select_by_user'])) { $sbu = $_GET['select_by_user']; if (empty($sbu)) { // Show just the current user's pages. $username_for_page_selection = $pguser; } else { // Explicitly specify a particular user. // This is only available to PFs & SAs. // (Yes, even though it merely filters // information that is available to all.) if (user_is_a_sitemanager() || user_is_proj_facilitator()) { $username_for_page_selection = $sbu; } else { // Just show the current user's pages. $username_for_page_selection = $pguser; } } } else { // No 'select_by_user' parameter, so show all pages. $username_for_page_selection = NULL; } // this only has any effect if the user is set too. $round_for_page_selection = NULL; if (isset($_GET['select_by_round'])) { $sbr = $_GET['select_by_round']; if (!empty($sbr) && $sbr != 'ALL') {
$relPath = '../pinc/'; include_once $relPath . 'base.inc'; include_once $relPath . 'dpsql.inc'; include_once $relPath . 'misc.inc'; // html_safe() include_once $relPath . 'project_states.inc'; include_once $relPath . 'stages.inc'; include_once $relPath . 'user_is.inc'; include_once $relPath . 'theme.inc'; include_once $relPath . 'release_queue.inc'; require_login(); if ($ordinary_users_can_see_queue_settings) { $user_can_see_queue_settings = TRUE; } else { // Only privileged users can see queue settings $user_can_see_queue_settings = user_is_a_sitemanager() || user_is_proj_facilitator(); } $round_id = get_enumerated_param($_GET, 'round_id', null, array_keys($Round_for_round_id_), true); $name = @$_GET['name']; if (is_null($round_id)) { $title = _("Release Queues"); output_header($title); echo "<br><h2>{$title}</h2>"; echo _("Each round has its own set of release queues."), "\n"; echo _("Please select the round that you're interested in:"), "\n"; echo "<ul>\n"; foreach (array_keys($Round_for_round_id_) as $round_id) { echo "<li><a href='release_queue.php?round_id={$round_id}'>{$round_id}</a></li>\n"; } echo "</ul>\n"; return;
function preview() { // insert e.g. templates and biographies $comments = parse_project_comments($this->comments); $a = _("The Guidelines give detailed instructions for working in this round."); $b = _('The instructions below are particular to this project, and <b>take precedence over those guidelines</b>.'); $now = strftime(_("%A, %B %e, %Y at %X")); echo "<br><table width='90%' border=1>"; echo "<tr><td align='middle' bgcolor='#cccccc'><h3>", _("Preview<br>Project"), "</h3></td>"; echo "<td bgcolor='#cccccc'><b>", _("This is a preview of your project and roughly how it will look to the proofreaders."), "</b></td></tr>\n"; echo "<tr><td align='middle' bgcolor='#cccccc'><b>", _("Title"), "</b></td><td>{$this->nameofwork}</td></tr>\n"; echo "<tr><td align='middle' bgcolor='#cccccc'><b>", _("Author"), "</b></td><td>{$this->authorsname}</td></tr>\n"; if (user_is_a_sitemanager()) { // SAs are the only ones who can change this. echo "<tr><td align='middle' bgcolor='#cccccc'><b>", _("Project Manager"), "</b></td><td>{$this->projectmanager}</td></tr>\n"; } echo "<tr><td align='middle' bgcolor='#cccccc'><b>", _("Last Proofread"), "</b></td><td>{$now}</td></tr>\n"; echo "<tr><td align='middle' bgcolor='#cccccc'><b>", _("Forum"), "</b></td><td>", _("Start a discussion about this project"), "</td></tr>\n"; echo "<tr><td colspan='2' bgcolor='#cccccc' align='center'>"; echo "<font size='+1'><b>", _("Project Comments"), "</b></font>"; echo "<br>{$a}<br>{$b}"; echo "</td></tr>\n"; echo "<tr><td colspan='2'>"; echo $comments; echo "</td></tr>\n"; echo "</table><br><br>"; }
function do_smooth_reading() { global $project, $code_url, $pguser, $date_format; if ($project->state != PROJ_POST_FIRST_CHECKED_OUT) { return; } $projectid = $project->projectid; $current_user_can_manage_SR_for_this_project = $project->PPer_is_current_user || user_is_a_sitemanager(); // i.e., can: // -- make the project available for SR (initially or again), // -- replace the SR-able text, // -- see SR-commitments, and // -- read SR'ed texts echo "<h4>", _('Smooth Reading'), "</h4>"; echo "<ul>"; if ($project->smoothread_deadline == 0) { echo "<li>"; echo _('This project has not been made available for Smooth Reading.'); echo "</li>"; if ($current_user_can_manage_SR_for_this_project) { echo "<li>"; echo _("But you can make it available."); echo _('Choose how long you want to make it available for.'); $link_start = "<a href='{$code_url}/tools/upload_text.php?project={$projectid}&stage=smooth_avail&weeks"; echo "<ul>"; echo "<li>{$link_start}=1'>" . _("one week") . "</a>"; echo "<li>{$link_start}=2'>" . _("two weeks") . "</a>"; echo "<li>{$link_start}=4'>" . _("four weeks") . "</a>"; echo "</ul>"; echo "</li>\n"; } } else { // Project has been made available for SR if (time() < $project->smoothread_deadline) { $sr_deadline_str = strftime($date_format, $project->smoothread_deadline); $sr_sentence = sprintf(_('This project has been made available for Smooth Reading until %s.'), "<b>{$sr_deadline_str}</b>"); echo "<li>"; echo $sr_sentence; echo "</li>\n"; if ($current_user_can_manage_SR_for_this_project) { echo "<li>"; echo "<a href='{$code_url}/tools/upload_text.php?project={$projectid}&stage=smooth_avail&weeks=replace'>"; echo _("Replace the currently available Smooth Reading file."); echo "</a>"; echo "</li>"; } if (!$project->PPer_is_current_user) { echo_download_zip(_("Download zipped text for Smooth Reading"), '_smooth_avail'); // We don't allow guests to upload the results of smooth-reading. global $user_is_logged_in; if ($user_is_logged_in) { echo "<li>"; echo "<a href='{$code_url}/tools/upload_text.php?project={$projectid}&stage=smooth_done'>"; echo _("Upload a smooth-read text"); echo "</a>"; echo "</li>\n"; // The upload does not cause the project to change state -- // it's still checked out to PPer. if (!sr_user_is_committed($projectid, $pguser)) { echo "<li>"; echo _('You can volunteer to smoothread this project for the PPer by pressing:'); sr_echo_commitment_form($projectid); echo "</li>\n"; } else { echo "<li>"; echo _('You have volunteered to smoothread this project.'); echo "<br />"; echo _('If you wish to withdraw from smoothreading it, please press:'); sr_echo_withdrawal_form($projectid); echo "</li>"; } } else { echo "<li>"; echo _('Please note that while unregistered guests are welcome to download texts for Smooth Reading, only registered volunteers are able to upload annotated texts.'); echo "\n"; echo _('A registration link is available at the top of this page.'); echo "</li>\n"; } } } else { echo "<li>"; echo _('The Smooth Reading deadline for this project has passed.'); echo "</li>"; if ($current_user_can_manage_SR_for_this_project) { echo "<li>"; echo _("But you can make it available for Smooth Reading for an additional period.") . " "; echo _('Choose how long you want to make it available for.'); $link_start = "<a href='{$code_url}/tools/upload_text.php?project={$projectid}&stage=smooth_avail&weeks"; echo "<ul>"; echo "<li>{$link_start}=1'>" . _("one week") . "</a>"; echo "<li>{$link_start}=2'>" . _("two weeks") . "</a>"; echo "<li>{$link_start}=4'>" . _("four weeks") . "</a>"; echo "</ul>"; echo "</li>\n"; } } if ($current_user_can_manage_SR_for_this_project) { $sr_list = sr_get_committed_users($projectid); echo "<li>"; if (count($sr_list) == 0) { echo _('No one has volunteered to smoothread this project.'); } else { echo _('The following users have volunteered to smoothread this project:'); echo "<ul>"; foreach ($sr_list as $sr_user) { $user_privmsg_url = get_url_to_compose_message_to_user($sr_user); echo "<li>"; echo "<a href={$user_privmsg_url}>{$sr_user}</a>"; echo "</li>\n"; } echo "</ul>\n"; } echo "</li>\n"; echo "<li>"; echo_uploaded_zips('_smooth_done_', _('smoothread')); echo "</li>"; } } echo "</ul>\n"; }
if ($project->checkedoutby != "") { // Maybe we should get this info via a // left outer join in the big select query. // (Actually, I tried it in a few cases and the left outer join was always slower.) $contact_url = get_url_to_compose_message_to_user($project->checkedoutby); print "<a href='{$contact_url}'>{$project->checkedoutby}</a>"; } echo "</td>\n"; // Project Status echo "<td valign='middle'>\n"; echo_project_state_changer($project); 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 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'>";
// if the user isn't a site manager or an access request reviewer // they can only access their own pages if (!(user_is_a_sitemanager() || user_is_an_access_request_reviewer())) { $username = $pguser; } if ($username && !User::is_valid_user($username)) { die("Invalid username"); } // start the page $title = _('Reviewing work'); output_header($title, NO_STATSBAR); echo "<h1>{$title}</h1>\n"; // show form echo "<form action='review_work.php' method='GET'>"; echo "<table>"; if (user_is_a_sitemanager() || user_is_an_access_request_reviewer()) { // only let site admins or reviewers to access non-self records echo "<tr>"; echo "<td>" . _("Username") . "</td>"; echo "<td><input name='username' type='text' size='26' value='{$username}'></td>"; echo "</tr>"; } echo "<tr>"; echo "<td>" . _("Work Round") . "</td>"; echo "<td><select name='work_round_id'>"; _echo_round_select($rounds, $work_round_id); echo "</select>"; echo "</tr>"; echo "<tr>"; echo "<td>" . _("Review Round") . "</td>"; echo "<td><select name='review_round_id'>";
<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once $relPath . 'theme.inc'; include_once $relPath . 'user_is.inc'; include_once $relPath . 'misc.inc'; // html_safe() include_once $relPath . 'site_news.inc'; require_login(); if (!(user_is_a_sitemanager() or user_is_site_news_editor())) { die("You are not authorized to use this form."); } $news_page_id = get_enumerated_param($_GET, 'news_page_id', null, array_keys($NEWS_PAGES), true); if (isset($news_page_id)) { if (isset($NEWS_PAGES[$news_page_id])) { $news_subject = get_news_subject($news_page_id); $title = sprintf(_('News Desk for %s'), $news_subject); output_header($title); echo "<br>"; echo "<a href='sitenews.php'>" . _("Site News Central") . "</a><br>"; echo "<h1 align='center'>{$title}</h1>"; echo "<br>\n"; handle_any_requested_db_updates($news_page_id); show_item_editor($news_page_id); show_all_news_items_for_page($news_page_id); } else { echo _("Error") . ": <b>" . $news_page_id . "</b> " . _("Unknown news_page_id specified, exiting."); } } else { output_header(_("Site News Central"));
function TaskDetails($tid) { global $requester_u_id, $tasks_url; global $os_array, $browser_array, $tasks_close_array; global $pguser; if (!is_numeric($tid)) { ShowNotification("Error: task identifier '{$tid}' is not numeric."); return; } $res = mysql_query("SELECT * FROM tasks WHERE task_id = {$tid} LIMIT 1"); if (mysql_num_rows($res) >= 1) { while ($row = mysql_fetch_assoc($res)) { $userSettings =& Settings::get_Settings($pguser); $notification_settings = $userSettings->get_values('taskctr_notice'); if (in_array($tid, $notification_settings) || in_array('all', $notification_settings)) { $already_notified = 1; } else { $already_notified = 0; } $opened_by_link = property_format_value('opened_by', $row, FALSE); $edited_by_link = property_format_value('edited_by', $row, FALSE); // Task id, summary, and possible Edit/Re-Open Task buttons. echo "<table class='tasks'>\n"; echo "<tr bgcolor='#ecdbb7'>"; echo "<td width='90%' valign='middle'>"; echo "Task #{$tid} " . property_format_value('task_summary', $row, FALSE); echo "</td>"; echo "<td width='10%' valign='middle' style='text-align:right;'>"; echo "<form action='{$tasks_url}' method='post'>\n"; if ((user_is_a_sitemanager() || user_is_taskcenter_mgr() || $row['opened_by'] == $requester_u_id) && empty($row['closed_reason'])) { echo "<input type='hidden' name='action' value='show_editing_form'>\n"; echo "<input type='hidden' name='task_id' value='{$tid}'>\n"; echo "<input type='submit' value='Edit Task' class='taskinp2'>\n"; } elseif (!empty($row['closed_reason'])) { echo "<input type='hidden' name='action' value='reopen'>\n"; echo "<input type='hidden' name='task_id' value='{$tid}'>\n"; echo "<input type='submit' value='Re-Open Task' class='taskinp2'>\n"; } else { echo " \n"; } echo "</form>"; echo "</td>"; echo "</tr>"; echo "</table>\n"; echo "<table class='tasks'>\n"; // Row 1: Opened & Last edited. Link to toggle task notifications. echo "<tr>"; echo "<td width='50%'>"; echo "<small class='task'>"; echo "Opened by {$opened_by_link} - " . property_format_value('date_opened', $row, FALSE); echo "<br />"; echo "Last edited by {$edited_by_link} - " . property_format_value('date_edited', $row, FALSE); echo "</small>"; echo "</td>"; echo "<td width='50%' style='text-align:right;'>"; if (empty($already_notified)) { echo "<a href='{$tasks_url}?action=notify_me&task_id={$tid}'>Signup for task notifications</a>"; } else { echo "<a href='{$tasks_url}?action=unnotify_me&task_id={$tid}'>Remove me from task notifications</a>"; } echo "</tr>\n"; // Row 2: most of the task's simple properties echo "<tr>"; echo "<td width='40%'>"; echo "<table class='taskplain'>\n"; property_echo_value_tr('task_type', $row); property_echo_value_tr('task_category', $row); property_echo_value_tr('task_status', $row); property_echo_value_tr('task_assignee', $row); property_echo_value_tr('task_os', $row); echo "</table>"; echo "</td>"; echo "<td width='50%'>"; echo "<table class='taskplain'>\n"; property_echo_value_tr('task_browser', $row); property_echo_value_tr('task_severity', $row); property_echo_value_tr('task_priority', $row); property_echo_value_tr('task_version', $row); property_echo_value_tr('percent_complete', $row); echo "</table>"; echo "</td>"; echo "</tr>\n"; // Row 3: summary of votes/metoos $voteInfo = mysql_query("SELECT id FROM tasks_votes WHERE task_id = {$tid}"); $osInfo = mysql_query("SELECT DISTINCT vote_os FROM tasks_votes WHERE task_id = {$tid}"); $browserInfo = mysql_query("SELECT DISTINCT vote_browser FROM tasks_votes WHERE task_id = {$tid}"); if (mysql_num_rows($voteInfo) > 0) { $reportedOS = ""; $reportedBrowser = ""; echo "<tr>"; echo "<td colspan='2'>"; echo "<table class='taskplain'>"; echo "<tr>"; echo "<td width='25%'>"; echo "<b>Votes </b>"; echo "</td>\n"; echo "<td width='75%'>"; echo mysql_num_rows($voteInfo); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td width='25%'>"; echo "<b>Reported Operating Systems </b>"; echo "</td>\n"; echo "<td width='75%'>"; while ($rowOS = mysql_fetch_assoc($osInfo)) { $reportedOS .= $os_array[$rowOS['vote_os']] . ", "; } echo substr($reportedOS, 0, -2); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td width='25%'>"; echo "<b>Reported Browsers </b>"; echo "</td>\n"; echo "<td width='75%'>"; while ($rowBrowser = mysql_fetch_assoc($browserInfo)) { $reportedBrowser .= $browser_array[$rowBrowser['vote_browser']] . ", "; } echo substr($reportedBrowser, 0, -2); echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; } // Row 4: details echo "<tr>"; echo "<td>"; echo "<br />"; echo "<table class='taskplain'>"; echo "<tr>"; echo "<td width='5%'>"; echo "<b>Details </b>"; echo "</td>\n"; echo "<td width='95%' class='taskvalue'>"; echo property_format_value('task_details', $row, FALSE); echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>\n"; // Row 5: Close Task. Me Too! echo "<tr>\n"; if ((user_is_a_sitemanager() || user_is_taskcenter_mgr()) && empty($row['closed_reason'])) { echo "\n <td>\n <br />\n <form action='{$tasks_url}' method='post'>\n <input type='hidden' name='action' value='close'>\n <input type='hidden' name='task_id' value='{$tid}'>\n <table class='taskplain'>\n <tr>\n <td width='20%' valign='bottom'>\n <b>Close Task </b>\n </td>\n <td valign='bottom' width='80%'>\n "; dropdown_select('closed_reason', "", $tasks_close_array); echo "\n <input type='submit' value='Close Task' class='taskinp2'>\n </td>\n </tr>\n </table>\n </form>\n </td>\n "; } elseif (!empty($row['closed_reason'])) { $closed_by = property_format_value('closed_by', $row, FALSE); $date_closed = property_format_value('date_closed', $row, FALSE); $reason = property_format_value('closed_reason', $row, FALSE); echo "\n <td>\n <br />\n <small class='task'>\n Closed by: {$closed_by}\n <br />\n Date Closed: {$date_closed}\n <br />\n Reason: {$reason}\n </small>\n </td>\n "; } echo "<td>"; echo "<br />"; $meTooCheckResult = mysql_query("\n SELECT id\n FROM tasks_votes\n WHERE task_id = {$tid} and u_id = {$requester_u_id}\n "); $meTooAllowed = mysql_num_rows($meTooCheckResult) == 0; mysql_free_result($meTooCheckResult); if ($meTooAllowed) { echo "<input type='button' value='Me Too!' class='taskinp2' onClick=\"showSpan('MeTooMain');\">"; } else { echo " "; } echo "</td>"; echo "</tr>"; echo "</table>"; echo "<br />\n"; if ($meTooAllowed) { MeToo($tid, $row['task_os'], $row['task_browser']); } TaskComments($tid); RelatedTasks($tid); echo "<br />\n"; RelatedPostings($tid); } } else { ShowNotification("Task #{$tid} was not found!"); } }
include_once $relPath . 'DPage.inc'; include_once $relPath . 'project_states.inc'; include_once $relPath . 'Project.inc'; // project_get_auto_PPer include_once $relPath . 'misc.inc'; // requester_is_localhost() include_once 'autorelease.inc'; $one_project = validate_projectID('project', @$_GET['project'], true); $refresh_url = @$_GET['return_uri']; // The following users are authorized to run this script: // 1) localhost (eg: run from crontab) - can operate on all projects // 2) SA and PFs - can operates on all projects // 3) PMs - can operate only on their own projects if (!requester_is_localhost()) { require_login(); if (!user_is_a_sitemanager() && !user_is_proj_facilitator()) { if ($one_project) { $project = new Project($one_project); if (!$project->can_be_managed_by_user($pguser)) { die('You are not authorized to invoke this script.'); } } else { die('You are not authorized to invoke this script.'); } } } if (!isset($refresh_url)) { $refresh_url = 'projectmgr.php'; } $trace = FALSE; // -----------------------------------------------------------------------------
function manage_form($locale) { global $dyn_locales_dir, $translate_url, $charset; $system_locales = get_installed_system_locales(); $translation_enabled = is_locale_translation_enabled($locale); echo "<p><a href='{$translate_url}'>" . _("Back to the Translation Center") . "</a></p>"; echo "<h1>" . sprintf(_("Managing locale %s"), $locale) . "</h1>\n"; echo "<p><b>" . _("Locale") . ":</b> {$locale}</p>\n"; if (!in_array($locale, $system_locales)) { echo "<p><b>" . sprintf(_("Warning: While a locale translation exists for %s, a system locale does not. Without a system locale installed, gettext will not use this translation."), $locale) . "</b></p>"; } echo "<p><b>" . _("Language") . ":</b> " . eng_name($locale) . "</p>\n"; echo "<p><b>" . _("Translation status") . ":</b> "; if ($translation_enabled) { echo _("Enabled"); } else { echo _("Disabled"); } echo "</p>\n"; $po_filename = "{$dyn_locales_dir}/{$locale}/LC_MESSAGES/messages.po"; $po_file = new POFile($po_filename); if ($po_file->exists) { $total_strings = $po_file->messages_count; $translated_strings = $po_file->messages_translated_count; echo "<p><b>" . _("PO file") . ":</b> "; echo "<a href='{$translate_url}?func=view&locale={$locale}'>" . _("View") . "</a> | <a href='{$translate_url}?func=download&locale={$locale}'>" . _("Download") . "</a> (" . _("Last modified") . ": " . date("F d Y H:i:s", $po_file->last_modified) . ")"; echo " - "; echo sprintf(_('%1$s of %2$s translated (%3$d%%)'), $translated_strings, $total_strings, $translated_strings / $total_strings * 100); echo "</p>"; $pot_filename = "{$dyn_locales_dir}/messages.pot"; $pot_file = new POFile($pot_filename); if ($pot_file->exists && $pot_file->last_modified > $po_file->last_modified) { echo "<p>" . _("The current template is more recent than the PO file. You should merge the PO file with the current template.") . "</p>"; } echo "<form action='{$translate_url}?func=merge' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; echo "<input type='submit' value='" . attr_safe(_("Merge current PO file with the current template")) . "'> "; echo _("Run <code>msgmerge</code> to update the current PO file against the current template.") . "<br>\n"; echo "<input type='checkbox' name='fuzzy'> " . _("Do fuzzy matching when an exact match is not found (can be much slower)") . "<br>"; echo "</form><br><br>\n"; } else { echo "<p>" . _("No PO file.") . "</p>\n"; } echo "<form action='{$translate_url}?func=upload' method='POST' enctype='multipart/form-data'>\n"; echo "<input type='hidden' name='locale' value='{$locale}'>"; echo _("Select a PO file to upload:") . " "; echo "<input type='hidden' name='MAX_FILE_SIZE' value='5000000'>"; echo "<input type='file' name='userfile'><br>\n"; echo "<input type='submit' value='" . attr_safe(_("Upload file")) . "'> "; echo _("This replaces the current PO file with the file you provide, and installs the translation for use by the site."); echo "</form>\n"; if (user_is_a_sitemanager()) { echo "<br><br>"; echo "<h2>" . _("Site administrator functions") . "</h2>"; echo "<form action='{$translate_url}?func=changeenable' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; if ($translation_enabled) { $checkbox_state = "checked"; } else { $checkbox_state = ""; } echo "<input type='checkbox' name='enable_locale' value='1' {$checkbox_state}> "; echo _("Enable locale translation") . " "; echo "<input type='submit' value='" . attr_safe(_("Save")) . "'> "; echo "</form>\n"; echo "<br><br>"; echo "<form action='{$translate_url}?func=delete' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; $confirm = javascript_safe(_("Are you sure you want to delete this locale and its translation file?"), $charset); echo "<input type='submit' onClick='return confirm(\"{$confirm}\");' value='" . attr_safe(_("Delete this locale")) . "'> "; echo _("Delete the locale directory, PO file and MO file.") . "<br>\n"; echo "</form>\n"; } }