public function applyOnlyTools()
 {
     $am = AccountManager::getInstance();
     // We start by cleaning up the database
     $this->conn->query("DELETE FROM `errorfiles` WHERE `project`='%s'", array($am->project));
     // We start by all translation
     // We select files how have revision=en_revision for this lang
     $query = 'SELECT * FROM files WHERE `project`="%s" AND `lang`!="%s" AND `revision`=`en_revision`';
     $params = array($am->project, 'en');
     $r = $this->conn->query($query, $params);
     while ($a = $r->fetch_object()) {
         $error = new ToolsError();
         $fileEN = new File('en', $a->path . $a->name);
         $ENContent = $fileEN->read(true);
         $fileLANG = new File($a->lang, $a->path . $a->name);
         $LANGContent = $fileLANG->read(true);
         $error->setParams($ENContent, $LANGContent, $a->lang, $a->path, $a->name, '');
         $error->run();
         $error->saveError();
     }
     //.... and now, EN files
     $query = 'SELECT * FROM files WHERE `project`="%s" AND `lang`="%s"';
     $params = array($am->project, 'en');
     $r = $this->conn->query($query, $params);
     while ($a = $r->fetch_object()) {
         $error = new ToolsError();
         $fileEN = new File('en', $a->path . $a->name);
         $ENContent = $fileEN->read(true);
         $error->setParams($ENContent, '', $a->lang, $a->path, $a->name, '');
         $error->run();
         $error->saveError();
     }
 }
Exemplo n.º 2
0
<?php

session_start();
error_reporting(E_ALL);
require_once "./php/AccountManager.php";
require_once "./php/ToolsError.php";
$am = AccountManager::getInstance();
$am->isLogged();
if (isset($_GET['dir']) && isset($_GET['file'])) {
    // We retrieve all this error from DB to display the value.
    $errorTools = new ToolsError();
    $errorTools->setParams('', '', $am->vcsLang, $_GET['dir'], $_GET['file'], '');
    $error_to_display = $errorTools->getInfo();
    if (empty($error_to_display)) {
        // We fake an empty error
        $error_to_display['-No error-']['error'][0]['value_en'] = '-';
        $error_to_display['-No error-']['error'][0]['value_lang'] = '-';
    }
    $fileLibel = $_GET['dir'] . $_GET['file'];
} else {
    $error_to_display = array();
    $fileLibel = NULL;
}
?>
<style type="text/css">

.member-table {
    font-size: 13px;
    color: #222222;
    font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
    margin: 10px;
 /**
  * Get all files from witch an error have been detected
  */
 public function getFilesError()
 {
     if (!AccountManager::getInstance()->isLogged()) {
         return JsonResponseBuilder::failure();
     }
     $errorTools = new ToolsError();
     $errorTools->setParams('', '', AccountManager::getInstance()->vcsLang, '', '', '');
     $r = $errorTools->getFilesError(RepositoryFetcher::getInstance()->getModifies());
     return JsonResponseBuilder::success(array('nbItems' => $r['nb'], 'Items' => $r['node']));
 }