include_once("/home/duane/translingo.org/includes/general.php");
$smarty->display('lheader.tpl');
$pid = intval($_GET['pid']);
if(intval($_POST['pid']) > 0)
$pid = intval($_POST['pid']);
if($user->pid != $pid)
{
$user->pid = $pid;
$user->update();
}
$proj =& new DataObject_Projects();
$proj->id = $pid;
$proj->find(false);
$proj->fetch();
$smarty->assign('project_name', $proj->short);
unset($proj);
$proj =& new DataObject_Base();
$proj->pid = $pid;
$projcount = $proj->count();
$smarty->assign('base',$projcount);
$smarty->assign('languages',$language);
$smarty->assign('pid',$pid);
$proj =& new DataObject_Projects();
$proj->id = $pid;
$proj->find(false);
$proj->fetch();
if($proj->memid == $user->id)
$smarty->assign('admin', '1');
$langs =& new DataObject_Translations();
$langs->pid = $pid;
$langs->groupBy("language");
$langs->find(false);
while($langs->fetch())
{
$lang = clone($langs);
$query = "select * from `translations` where `language` = '$lang->language' and
`pid` = '$pid' and `fuzzy`=0 group by `baseid`";
$query2 = "select * from `translations` where `language` = '$lang->language' and
`pid` = '$pid' group by `baseid`";
$lc = mysqli_num_rows(mysqli_query($_SESSION['_config']['mysqli'], $query));
$lc2 = mysqli_num_rows(mysqli_query($_SESSION['_config']['mysqli'], $query2));
$averagelc += $lc;
$lang->lc = $lc;
$lang->lc2 = $lc2;
$query = "select * from `translations` where `language` = '$lang->language' and
`pid` = '$pid' and `fuzzy`='1' group by `baseid`";
$query2 = "select * from `translations` where `language` = '$lang->language' and `fuzzy`=0 and
`pid` = '$pid' order by `revision` desc";
$lc = mysqli_num_rows(mysqli_query($_SESSION['_config']['mysqli'], $query));
$row = mysqli_fetch_assoc(mysqli_query($_SESSION['_config']['mysqli'], $query2));
$averagefuzzy += $lc;
$lang->fuzzy = $lc;
if($row['dl'] == 1)
$lang->lastupdate = $row['revision'];
else
$lang->lastupdate = "**${row['revision']}**";
$lang->percent = number_format(($lang->lc - $lang->fuzzy) / $projcount * 100, 2)."%";
$lang->alltranslink = "searchproject.php?pid=$pid&lang=$lang->language&translated=2&fuzzy=2&searchlang=1";
$lang->translink = "editproject.php?pid=$pid&editlanguage=$lang->language&noskip=1";
$lang->searchlink = "searchproject.php?pid=$pid&lang=$lang->language&translated=2&fuzzy=2&searchlang=1";
$lang->lclink = "searchproject.php?pid=$pid&lang=$lang->language&translated=1&fuzzy=0&searchlang=1";
$lang->lclink2 = "searchproject.php?pid=$pid&lang=$lang->language&translated=1&fuzzy=2&searchlang=1";
$lang->fuzzylink = "searchproject.php?pid=$pid&lang=$lang->language&fuzzy=1&translated=1&searchlang=1";
$lang->poupload = "poupload.php?pid=$pid&editlanguage=$lang->language";
$lang->export = "export.php?pid=$pid&editlanguage=$lang->language";
$smarty->append('langs', $lang);
$langnum++;
}
if($langnum >= 1)
{
$smarty->assign('averagelc', number_format($averagelc / $langnum, 1));
$smarty->assign('averagefuzzy', number_format($averagefuzzy / $langnum, 1));
$smarty->assign('averagepercent', number_format(($averagelc - $averagefuzzy) / $langnum / $projcount * 100, 2)."%");
}
$row = mysqli_fetch_assoc(mysqli_query($_SESSION['_config']['mysqli'], "select * from `translations` where `fuzzy`=0 and
`pid` = '$pid' order by `revision` desc"));
if($row['dl'] == 1)
$smarty->assign('lastupdate', $row['revision']);
else
$smarty->assign('lastupdate', "".$row['revision']."");
$smarty->display('project.tpl');
$smarty->display('lfooter.tpl');
?>