protected function _getCache()
 {
     if (!$this->cache) {
         $this->cache = Bugzilla::getCache();
     }
     return $this->cache;
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     Kohana::config_load('workermgmt');
     $this->profiler = IN_DEV_MODE ? new Profiler() : null;
     $requested_area = strtolower(Router::$controller . "::" . Router::$method);
     if (!in_array($requested_area, $this->non_authed_areas)) {
         // run authentication
         if (!Bugzilla::instance(Kohana::config('workermgmt'))->authenticated()) {
             url::redirect('login');
         }
     }
 }
namespace Transvision;

$source = Utils::getRepoStrings(Project::getReferenceLocale($repo), $repo);
$target = Utils::getRepoStrings($locale, $repo);
// Set up channel selector, ignore mozilla.org
$channels = Project::getSupportedRepositories();
unset($channels['mozilla_org']);
$channel_selector = Utils::getHtmlSelectOptions($channels, $repo, true);
// Build the target locale switcher
$target_locales_list = Utils::getHtmlSelectOptions(Project::getRepositoryLocales($repo), $locale);
$source = array_map(['Transvision\\AnalyseStrings', 'cleanUpEntities'], $source);
$target = array_map(['Transvision\\AnalyseStrings', 'cleanUpEntities'], $target);
// We need to ignore some strings because of false positives
$ignored_strings = ['mail/chrome/messenger/aboutRights.dtd:rights.webservices-term4', 'suite/chrome/branding/aboutRights.dtd:rights.webservices-term4', 'toolkit/chrome/global/aboutRights.dtd:rights.webservices-term5'];
$var_errors = AnalyseStrings::differences($source, $target, $repo, $ignored_strings);
$error_count = count($var_errors);
// Add component filter
if (in_array($repo, $desktop_repos)) {
    // Build logic to filter components
    $javascript_include = ['component_filter.js'];
    $components = Project::getComponents(array_flip($var_errors));
    $filter_block = '';
    foreach ($components as $value) {
        $filter_block .= " <a href='#{$value}' id='{$value}' class='filter'>{$value}</a>";
    }
}
// RTL support
$direction1 = RTLSupport::getDirection($source_locale);
$direction2 = RTLSupport::getDirection($locale);
$bugzilla_base_link = 'https://bugzilla.mozilla.org/enter_bug.cgi?format=__default__&component=' . Bugzilla::getURLencodedBugzillaLocale($locale, 'products') . '&product=Mozilla%20Localizations&status_whiteboard=%5Btransvision-feedback%5D';
Example #4
0
        $bz_target_string2 = $target_string2 = isset($tmx_target2[$entity]) ? Utils::secureText($tmx_target2[$entity]) : '';
        // Highlight non-breaking spaces only after strings have been escaped
        $target_string2 = str_replace(' ', '<span class="highlight-gray"> </span>', $target_string2);
        switch ($current_repo) {
            case 'mozilla_org':
                $path_locale3 = VersionControl::gitPath($locale2, $current_repo, $entity);
                break;
            case 'firefox_ios':
                $path_locale3 = VersionControl::svnPath($locale2, $current_repo, $entity);
                break;
            default:
                $path_locale3 = VersionControl::hgPath($locale2, $current_repo, $entity);
                break;
        }
        // Link to entity
        $entity_link = "?sourcelocale={$source_locale}" . "&locale={$locale2}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$entity}";
        $file_bug = '<a class="bug_link" target="_blank" href="' . Bugzilla::reportErrorLink($locale2, $entity, $source_string, $bz_target_string2, $current_repo, $entity_link) . '">&lt;report a bug&gt;</a>';
        $extra_column_rows = "\n    <td dir='{$direction3}'>\n      <span class='celltitle'>{$locale2}</span>\n      <div class='string'>{$target_string2}</div>\n      <div dir='ltr' class='result_meta_link'>\n        <a class='source_link' href='{$path_locale3}'><em>&lt;source&gt;</em></a>\n        {$file_bug}\n      </div>\n    </td>";
    } else {
        $extra_column_rows = '';
    }
    // Link to entity
    $entity_link = "?sourcelocale={$source_locale}" . "&locale={$locale}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$entity}";
    $file_bug = '<a class="bug_link" target="_blank" href="' . Bugzilla::reportErrorLink($locale, $entity, $source_string, $bz_target_string, $current_repo, $entity_link) . '">&lt;report a bug&gt;</a>';
    $anchor_name = str_replace(['/', ':'], '_', $entity);
    $table .= "\n  <tr>\n    <td>\n      <span class='celltitle'>Entity</span>\n      <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this result'>link</a>\n      <a class='l10n tag' href='/string/?entity={$entity}&amp;repo={$current_repo}' title='List all translations for this entity'>l10n</a>\n      <a class='link_to_entity' href='/{$entity_link}'>" . ShowResults::formatEntity($entity, $initial_search) . "</a>\n    </td>\n    <td dir='{$direction1}'>\n      <span class='celltitle'>{$source_locale}</span>\n      <div class='string'>{$source_string}</div>\n      <div dir='ltr' class='result_meta_link'>\n        <a class='source_link' href='{$path_locale1}'><em>&lt;source&gt;</em></a>\n      </div>\n    </td>\n    <td dir='{$direction2}'>\n      <span class='celltitle'>{$locale}</span>\n      <div class='string'>{$target_string}</div>\n      <div dir='ltr' class='result_meta_link'>\n        <a class='source_link' href='{$path_locale2}'><em>&lt;source&gt;</em></a>\n        {$file_bug}\n      </div>\n    </td>\n    {$extra_column_rows}\n  </tr>\n";
}
$table .= "</table>\n\n";
if ($entities) {
    print $table;
}
Example #5
0
}
// IRC Transcript
$irc = new IRC();
$results = $irc->get_rows($irc->get_max_id(), $tableRowsToShow);
$ircnav = l("#browserplus", "/discuss/");
$irctable = render_table($results, "stamp", "who", "utterance", array("show_long_dates" => true, "top_nav" => "<strong>IRC: {$ircnav}</strong>"));
//$ircwidgets = $irc->render_widget("day") . $irc->render_widget("week") . $irc->render_widget("month");
$ircwidgets = $irc->render_widget("week");
// GIT Projects
$git = new GIT();
$results = $git->get_rows($tableRowsToShow);
$gitnav = "<strong>GitHub: <a href=\"http://www.github.com/browserplus/\">BrowserPlus</a></strong>";
$gittable = render_table($results, "tcommit", "project", "msg", array("show_long_dates" => true, "top_nav" => $gitnav, "url_key" => "url", "url_pat" => "%s"));
$gitwidgets = $git->render_project_widget();
// bugzilla issues
$bugzilla = new Bugzilla();
$issuewidget = $bugzilla->render_widget($listItemsToShow);
// Links Widget
$linkswidget = get_links_widget();
// Blog Widget
$blogwidget = get_blog_widget($listItemsToShow);
// Twitter Widgets
$twitter = new Twitter();
$tw_user_widget = $twitter->render_user_widget("browserplus", $listItemsToShow);
$tw_search_widget = $twitter->render_search_widget("browserplus", $listItemsToShow);
$forums = new Forum();
$forum_widget = $forums->render_widget($listItemsToShow);
$body = <<<EOS
<div class="home-logs">
    <div class="home-irc-log">{$irctable}</div>
    <div class="home-git-log">{$gittable}</div>
Example #6
0
 /**
  * Html table of search results used by the main view (needs a lot of refactoring)
  *
  * @param array  $search_id      Identifier for the current search
  * @param array  $search_results List of rows
  * @param string $recherche      The words searched for
  * @param string $locale1        Reference locale to search in, usually en-US
  * @param string $locale2        Target locale to search in
  * @param array  $search_options All the search options from the query
  *
  * @return string html table to insert in the view
  */
 public static function resultsTable($search_id, $search_results, $recherche, $locale1, $locale2, $search_options)
 {
     $direction1 = RTLSupport::getDirection($locale1);
     $direction2 = RTLSupport::getDirection($locale2);
     if (isset($search_options['extra_locale'])) {
         $locale3 = $search_options['extra_locale'];
         $direction3 = RTLSupport::getDirection($locale3);
         $extra_column_header = "<th>{$locale3}</th>";
     } else {
         $extra_column_header = '';
     }
     $table = "<table class='collapsable results_table {$search_id}'>\n                      <tr class='column_headers'>\n                        <th>Entity</th>\n                        <th>{$locale1}</th>\n                        <th>{$locale2}</th>\n                        {$extra_column_header}\n                      </tr>";
     if (!$search_options['whole_word'] && !$search_options['perfect_match']) {
         $recherche = Utils::uniqueWords($recherche);
     } else {
         $recherche = [$recherche];
     }
     $current_repo = $search_options['repo'];
     foreach ($search_results as $key => $strings) {
         // Don't highlight search matches in entities when searching strings
         if ($search_options['search_type'] == 'strings') {
             $result_entity = self::formatEntity($key);
         } else {
             $result_entity = self::formatEntity($key, $recherche[0]);
         }
         $component = explode('/', $key)[0];
         $source_string = trim($strings[0]);
         $target_string = trim($strings[1]);
         $entity_link = "?sourcelocale={$locale1}" . "&locale={$locale2}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$key}";
         $bz_link = [Bugzilla::reportErrorLink($locale2, $key, $source_string, $target_string, $current_repo, $entity_link)];
         if (isset($search_options['extra_locale'])) {
             $target_string2 = trim($strings[2]);
             $entity_link = "?sourcelocale={$locale1}" . "&locale={$search_options['extra_locale']}" . "&repo={$current_repo}" . "&search_type=entities&recherche={$key}";
             $bz_link[] = Bugzilla::reportErrorLink($search_options['extra_locale'], $key, $source_string, $target_string2, $current_repo, $entity_link);
         } else {
             $target_string2 = '';
         }
         foreach ($recherche as $val) {
             $source_string = Utils::markString($val, $source_string);
             $target_string = Utils::markString($val, $target_string);
             if (isset($search_options["extra_locale"])) {
                 $target_string2 = Utils::markString($val, $target_string2);
             }
         }
         // Escape HTML before highlighing search terms
         $source_string = htmlspecialchars($source_string);
         $target_string = htmlspecialchars($target_string);
         $source_string = Utils::highlightString($source_string);
         $target_string = Utils::highlightString($target_string);
         if (isset($search_options["extra_locale"])) {
             $target_string2 = htmlspecialchars($target_string2);
             $target_string2 = Utils::highlightString($target_string2);
         }
         $replacements = [' ' => '<span class="highlight-gray" title="Non breakable space"> </span>', ' ' => '<span class="highlight-red" title="Thin space"> </span>', '…' => '<span class="highlight-gray">…</span>', '&hellip;' => '<span class="highlight-gray">…</span>'];
         $target_string = Strings::multipleStringReplace($replacements, $target_string);
         $temp = explode('-', $locale1);
         $locale1_short_code = $temp[0];
         $temp = explode('-', $locale2);
         $locale2_short_code = $temp[0];
         switch ($current_repo) {
             case 'mozilla_org':
                 $locale1_path = VersionControl::gitPath($locale1, $current_repo, $key);
                 $locale2_path = VersionControl::gitPath($locale2, $current_repo, $key);
                 break;
             case 'firefox_ios':
                 $locale1_path = VersionControl::svnPath($locale1, $current_repo, $key);
                 $locale2_path = VersionControl::svnPath($locale2, $current_repo, $key);
                 break;
             default:
                 $locale1_path = VersionControl::hgPath($locale1, $current_repo, $key);
                 $locale2_path = VersionControl::hgPath($locale2, $current_repo, $key);
                 break;
         }
         // errors
         $error_message = '';
         // check for final dot
         if (substr(strip_tags($source_string), -1) == '.' && substr(strip_tags($target_string), -1) != '.') {
             $error_message = '<em class="error"> No final dot?</em>';
         }
         // check abnormal string length
         $length_diff = Utils::checkAbnormalStringLength($source_string, $target_string);
         if ($length_diff) {
             switch ($length_diff) {
                 case 'small':
                     $error_message = $error_message . '<em class="error"> Small string?</em>';
                     break;
                 case 'large':
                     $error_message = $error_message . '<em class="error"> Large String?</em>';
                     break;
             }
         }
         // Missing string error
         if (!$source_string) {
             $source_string = '<em class="error">warning: missing string</em>';
             $error_message = '';
         }
         if (!$target_string) {
             $target_string = '<em class="error">warning: missing string</em>';
             $error_message = '';
         }
         if (!$target_string2) {
             $target_string2 = '<em class="error">warning: missing string</em>';
             $error_message = '';
         }
         // Replace / and : in the key name and use it as an anchor name
         $anchor_name = str_replace(['/', ':'], '_', $key);
         $clipboard_target_string = 'clip_' . md5($target_string);
         // 3locales view
         if (isset($search_options["extra_locale"])) {
             switch ($current_repo) {
                 case 'mozilla_org':
                     $locale3_path = VersionControl::gitPath($locale3, $current_repo, $key);
                     break;
                 case 'firefox_ios':
                     $locale3_path = VersionControl::svnPath($locale3, $current_repo, $key);
                     break;
                 default:
                     $locale3_path = VersionControl::hgPath($locale3, $current_repo, $key);
                     break;
             }
             $clipboard_target_string2 = 'clip_' . md5($target_string2);
             $extra_column_rows = "\n                <td dir='{$direction3}' lang='{$locale3}'>\n                    <span class='celltitle'>{$locale3}</span>\n                    <div class='string' id='{$clipboard_target_string2}'>{$target_string2}</div>\n                    <div dir='ltr' class='result_meta_link'>\n                      <a class='source_link' href='{$locale3_path}'>\n                        &lt;source&gt;\n                      </a>\n                      &nbsp;\n                      <a class='bug_link' target='_blank' href='{$bz_link[1]}'>\n                        &lt;report a bug&gt;\n                      </a>\n                      <span class='clipboard' data-clipboard-target='#{$clipboard_target_string2}' alt='Copy to clipboard'><img src='/img/copy_icon_black_18x18.png'></span>\n                    </div>\n                  </td>";
         } else {
             $extra_column_rows = '';
         }
         $table .= "\n                <tr class='{$component} {$search_id}'>\n                  <td>\n                    <span class='celltitle'>Entity</span>\n                    <a class='resultpermalink tag' id='{$anchor_name}' href='#{$anchor_name}' title='Permalink to this result'>link</a>\n                    <a class='l10n tag' href='/string/?entity={$key}&amp;repo={$current_repo}' title='List all translations for this entity'>l10n</a>\n                    <a class='link_to_entity' href=\"/{$entity_link}\">{$result_entity}</a>\n                  </td>\n                  <td dir='{$direction1}' lang='{$locale1}'>\n                    <span class='celltitle'>{$locale1}</span>\n                    <div class='string'>\n                      {$source_string}\n                    </div>\n                    <div dir='ltr' class='result_meta_link'>\n                      <a class='source_link' href='{$locale1_path}'>\n                        &lt;source&gt;\n                      </a>\n                      <span>Translate with:</span>\n                      <a href='http://translate.google.com/#{$locale1_short_code}/{$locale2_short_code}/" . urlencode(strip_tags(html_entity_decode(html_entity_decode($source_string)))) . "' target='_blank'>Google</a>\n                      <a href='http://www.bing.com/translator/?from={$locale1_short_code}&to={$locale2_short_code}&text=" . urlencode(strip_tags(html_entity_decode(html_entity_decode($source_string)))) . "' target='_blank'>BING</a>\n                    </div>\n                  </td>\n\n                  <td dir='{$direction2}' lang='{$locale2}'>\n                    <span class='celltitle'>{$locale2}</span>\n                    <div class='string' id='{$clipboard_target_string}'>{$target_string}</div>\n                    <div dir='ltr' class='result_meta_link'>\n                      <a class='source_link' href='{$locale2_path}'>\n                        &lt;source&gt;\n                      </a>\n                      &nbsp;\n                      <a class='bug_link' target='_blank' href='{$bz_link[0]}'>\n                        &lt;report a bug&gt;\n                      </a>\n                      <span class='clipboard' data-clipboard-target='#{$clipboard_target_string}' alt='Copy to clipboard'><img src='/img/copy_icon_black_18x18.png'></span>\n                      {$error_message}\n                    </div>\n                  </td>\n                {$extra_column_rows}\n                </tr>";
     }
     $table .= "  </table>";
     return $table;
 }
Example #7
0
    }
}
if (count($optin_pages) == 0) {
    exit($html_output . '<p>There are no optional pages available at the moment.</p>');
}
$html_output .= "<h1>List of optional pages for <span>{$current_locale}</span></h1>\n  <table class='optinpages'>\n    <thead>\n      <tr>\n        <th>Filename</th>\n        <th>URL</th>\n        <th>Strings</th>\n        <th>Words</th>\n        <th>Opted-in</th>\n        <th>Actions</th>\n      </tr>\n    </thead>\n    <tbody>\n";
$bugzilla_locale = urlencode(Bugzilla::getBugzillaLocaleField($current_locale, 'www'));
$available_optins = [];
foreach ($optin_pages as $current_filename => $supported_locales) {
    $reference_locale = Project::getReferenceLocale($current_website);
    $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename);
    $get_words = function ($item) {
        return str_word_count(strip_tags($item));
    };
    $nb_words = array_sum(array_map($get_words, $reference_data['strings']));
    $nb_strings = count($reference_data['strings']);
    if (in_array($current_locale, $supported_locales)) {
        $status = '<span class=\'yes\'>yes</span>';
        $actions = '-';
    } else {
        $available_optins[] = $current_filename;
        $status = '<span class=\'no\'>no</span> ';
        $actions = '<a href="' . Bugzilla::getNewBugLink($current_locale, $bugzilla_locale, 'opt-in', [$current_filename]) . '"' . ' class="table_small_link" title="File a bug to request this page">Opt-in</a>';
    }
    $html_output .= "<tr>\n" . "  <td class='optin_filename'>{$current_filename}</td>\n" . '  <td>' . Project::getLocalizedURL($reference_data, $current_locale, 'html') . "</td>\n" . "  <td>{$nb_strings}</td>\n" . "  <td>{$nb_words}</td>\n" . "  <td class='optin_status'>{$status}</td>\n" . "  <td class='optin_actions'>{$actions}</td>\n" . "</tr>\n";
}
$html_output .= "</tbody>\n  </table>\n";
if (count($available_optins) > 0) {
    $html_output .= '<p>You can also <a href="' . Bugzilla::getNewBugLink($current_locale, $bugzilla_locale, 'opt-in', $available_optins) . '">file a bug to opt-in for all pages</a> currently unsupported (' . count($available_optins) . ').</p>';
}
echo $html_output;
Example #8
0
 public function __construct()
 {
     $this->bugzilla = Bugzilla::instance(Kohana::config('workermgmt'));
     parent::__construct();
 }
Example #9
0
#!/usr/bin/php
<?php 
include "/home/websites/browserplus/php/site.php";
include "/home/websites/browserplus/php/bugzilla.php";
// DOK_BASE - normally set in apache, but not available to scripts
putenv("DOK_BASE=/home/websites/browserplus/data");
$bugs = new Bugzilla();
$secret = $bugs->get_cache_secret();
$host = get_cfg_var('bp_env') == "local" ? "borg" : "browserplus.org";
fetch("http://{$host}/site/cache_bugzilla.php?s={$secret}");
<?php

namespace Transvision;

// Include the common simple search form
include __DIR__ . '/simplesearchform.php';
if ($error_count > 0) {
    $search_id = 'check_variable';
    $content = "<h2><span class=\"results_count_{$search_id}\">" . Utils::pluralize($error_count, 'result') . "</span> found</h2>\n";
    if (isset($filter_block)) {
        $content .= "<div id='filters'>" . "  <h4>Filter by folder:</h4>\n" . "  <a href='#showall' id='showall' class='filter'>Show all results</a>\n" . $filter_block . "</div>\n";
    }
    $content .= "<table class='collapsable results_table {$search_id}'>\n" . "  <tr>\n" . "    <th>Entity</th>\n" . "    <th>{$source_locale}</th>\n" . "    <th>{$locale}</th>\n" . "  </tr>\n";
    foreach ($var_errors as $string_id) {
        // Link to entity
        $string_id_link = "?sourcelocale={$source_locale}" . "&locale={$locale}" . "&repo={$repo}" . "&search_type=entities&recherche={$string_id}";
        $bugzilla_link = Bugzilla::reportErrorLink($locale, $string_id, $source[$string_id], $target[$string_id], $repo, $string_id_link);
        $path_locale1 = VersionControl::hgPath($source_locale, $repo, $string_id);
        $path_locale2 = VersionControl::hgPath($locale, $repo, $string_id);
        $component = explode('/', $string_id)[0];
        $content .= "<tr class='{$component} {$search_id}'>\n                       <td>\n                          <span class='celltitle'>Entity</span>\n                          <a class='link_to_entity' href=\"/{$string_id_link}\">" . ShowResults::formatEntity($string_id) . "</a>\n                       </td>\n                       <td dir='{$direction1}'>\n                          <span class='celltitle'>{$source_locale}</span>\n                          <div class='string'>" . Utils::secureText($source[$string_id]) . "</div>\n                          <div class='result_meta_link'>\n                            <a class='source_link' href='{$path_locale1}'><em>&lt;source&gt;</em></a>\n                          </div>\n                       </td>\n                        <td dir='{$direction2}'>\n                          <span class='celltitle'>{$locale}</span>\n                          <div class='string'>" . Utils::secureText($target[$string_id]) . "</div>\n                          <div class='result_meta_link'>\n                            <a class='source_link' href='{$path_locale2}'><em>&lt;source&gt;</em></a>\n                            <a class='bug_link' target='_blank' href='{$bugzilla_link}'>&lt;report a bug&gt;</a>\n                          </div>\n                       </td>\n                     </tr>\n";
    }
    $content .= "</table>\n";
} else {
    $content = "<h2>Congratulations, no errors found.</h2>";
}
print $content;
Example #11
0
<?php

include "../../php/site.php";
include "../../php/bugzilla.php";
$bugs = new Bugzilla();
// to make sure we're the ones calling
if (isset($_GET["s"]) && $_GET["s"] == $bugs->get_cache_secret()) {
    // fetches bugs
    $bugs->fetch_bugs();
}
Example #12
0
function BugzillaRender($input, array $args, Parser $parser, $frame = null)
{
    global $wgBugzillaRESTURL;
    // We don't want the page to be cached
    // TODO: Not sure if we need this
    $parser->disableCache();
    // TODO: Figure out to have the parser not do anything to our output
    // mediawiki docs are wrong :-(
    // error_log(print_r($parser->mStripState, true));
    // $parser->mStripState->addItem( 'nowiki', 'NOWIKI', true);
    // 'noparse' => true, 'isHTML' => true, 'markerType' => 'nowiki' );
    $input = $parser->recursiveTagParse($input, $frame);
    // Create a new bugzilla object
    $bz = Bugzilla::create($args, $input, $parser->getTitle());
    // Show the desired output (or an error if there was one)
    return $bz->render();
}
Example #13
0
<?php

include "../../php/site.php";
include "../../php/forum.php";
include "../../php/twitter.php";
include "../../php/db.php";
include "../../php/irc.php";
include "../../php/bugzilla.php";
$RowsToShow = 20;
$t = new Twitter();
$f = new Forum();
$irc = new IRC();
$bugzilla = new Bugzilla();
$twitterSearchItems = $t->render_search_mobile("browserplus", $RowsToShow);
$twitterUserItems = $t->render_user_mobile("browserplus", $RowsToShow);
$max = $irc->get_max_id();
$results = $irc->get_rows($max, $RowsToShow);
$ircItems = $irc->render_mobile($results, $max);
$issueItems = $bugzilla->render_mobile($RowsToShow);
$forumItems = $f->render_mobile($RowsToShow);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>BrowserPlus</title>
  <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
  <link rel="apple-touch-icon" href="/m/dashboard-icon.png" />
  <style type="text/css" media="screen">@import "/iui/dashboardx.css";</style><!-- http://www.phpied.com/cssmin-js/ -->
  <script type="application/x-javascript" src="/iui/iuix.js"></script>
  <style type="text/css" media="screen">
Example #14
0
 /**
  * Submit these bug types using the validated from data
  * 
  * @param array $bugs_to_file Must be known values of Bugzilla
  *      i.e. Bugzilla::BUG_NEWHIRE_SETUP, Bugzilla::BUG_HR_CONTRACTOR, ...
  * @param array $form_input The validated form input
  */
 private function file_these(array $bugs_to_file, $form_input)
 {
     $bugzilla = Bugzilla::instance(kohana::config('workermgmt'));
     foreach ($bugs_to_file as $bug_to_file) {
         $filing = $bugzilla->newhire_filing($bug_to_file, $form_input);
         if ($filing['error_message'] !== null) {
             client::messageSend($filing['error_message'], E_USER_ERROR);
         } else {
             client::messageSend($filing['success_message'], E_USER_NOTICE);
         }
     }
 }
 $todo_files = '';
 foreach (Project::getWebsiteFiles($current_website) as $current_filename) {
     // File not supported
     if (!Project::isSupportedLocale($current_website, $current_locale, $current_filename, $langfiles_subsets)) {
         continue;
     }
     // File marked as obsolete
     if (Project::isObsoleteFile($current_website, $current_filename, $current_locale)) {
         continue;
     }
     // File doesn't exist
     if (!file_exists(Project::getLocalFilePath($current_website, $current_locale, $current_filename))) {
         continue;
     }
     $supported_locale = true;
     $bugzilla_link = Bugzilla::getNewBugLink($current_locale, $bugzilla_locale, 'upload', [$current_filename]);
     // Load reference strings
     $reference_filename = Project::getLocalFilePath($current_website, $reference_locale, $current_filename);
     $reference_url = Project::getPublicFilePath($current_website, $reference_locale, $current_filename);
     $reference_data = LangManager::loadSource($current_website, $reference_locale, $current_filename);
     // Extract data from locale
     $locale_filename = Project::getLocalFilePath($current_website, $current_locale, $current_filename);
     $locale_url = Project::getPublicFilePath($current_website, $current_locale, $current_filename);
     $locale_analysis = LangManager::analyzeLangFile($current_website, $current_locale, $current_filename, $reference_data);
     if (!in_array($current_filename, $no_active_tag) && $website_name == 'www.mozilla.org') {
         $status = $locale_analysis['activated'] ? ' file_activated' : ' file_notactivated';
     } else {
         $status = ' file_activated';
     }
     // check if the lang file is in utf8
     if (Utils::isUTF8($locale_filename) == false) {
// Autoloading of composer dependencies
require_once __DIR__ . '/vendor/autoload.php';
$source_path = __DIR__ . '/sources/';
// Query request
$type = Utils::getQueryParam('type');
$repo = Utils::getQueryParam('repo');
$bugzilla = Utils::getQueryParam('bugzilla');
$repos = new Repositories($source_path);
$json_data = new Json();
// Only one repo requested
if ($repo != '') {
    $locales = $repos->getSingleRepository($repo);
    if ($locales) {
        die($json_data->outputContent($locales));
    } else {
        http_response_code(400);
        die('ERROR: unknown repository.');
    }
}
// Only one type of repo requested
if ($type != '') {
    die($json_data->outputContent($repos->getTypeRepositories($type)));
}
// Bugzilla components
if ($bugzilla != '') {
    $bugzilla_query = new Bugzilla($source_path);
    die($json_data->outputContent($bugzilla_query->getBugzillaComponents($bugzilla)));
}
// Display a list of all repositories
die($json_data->outputContent($repos->getRepositories()));