Page MenuHomeIn-Portal Phabricator

missing_label_search.php
No OneTemporary

File Metadata

Created
Wed, Nov 18, 4:45 PM

missing_label_search.php

<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
// new startup: begin
define('REL_PATH', 'admin/config');
$relation_level = count( explode('/', REL_PATH) );
define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
require_once FULL_PATH.'/kernel/startup.php';
// new startup: end
$FrontEnd=2;
class clsLangParser extends clsTemplateList
{
function clsLangParser($TemplateRoot)
{
$this->clsTemplateList($TemplateRoot);
}
function ParseTag($raw)
{
$res = "";
//echo "Tag:".htmlentities($raw).":<br>\n";
if(strlen(trim($raw))>0)
{
$tag = new clsHtmlTag($raw);
switch($tag->name)
{
case "include":
case "perm_include":
$res = "<!-- include skipped -->";
break;
case "mod_include":
$res = "<!-- include skipped -->";
break;
default:
//if($tag->name=="m_language")
$res = $tag->Execute();
break;
}
unset($tag);
}
return $res;
}
}
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
//require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$section = "in-portal:missing_label_search";
$FilesPerLoad = 20;
$ado = &GetADODBConnection();
if($_GET["LangId"])
{
$LangId = $_GET["LangId"];
$ThemeId = $_GET["theme"];
$table = $objSession->GetSessionTable("_".$ThemeId."_labels");
@$ado->Execute("DROP TABLE IF EXISTS $table ");
$Phrases = new clsPhraseList();
$query = "SELECT * FROM ".$Phrases->SourceTable." WHERE PhraseId = -1";
$insert = "CREATE TABLE ".$table." ".$query;
$ado->Execute($insert);
$FileIndex = 0;
$objThemeFiles = new clsThemeFileList($ThemeId);
$NumFiles = TableCount($objThemeFiles->SourceTable,"ThemeId=$ThemeId",0);
$objSession->SetVariable("Missing_ThemeId",$ThemeId);
$objSession->SetVariable("Missing_LangId",$LangId);
}
else
{
$ThemeId = $objSession->GetVariable("Missing_ThemeId");
$table = $objSession->GetSessionKey()."_".$ThemeId."_labels";
$objThemeFiles = new clsThemeFileList($ThemeId);
$LangId = $objSession->GetVariable("Missing_LangId");
$FileIndex = $_GET["File"];
$NumFiles = $_GET["NumFiles"];
}
$l = $objLanguages->GetItem($LangId);
$name = $l->Get("PackName");
$objThemeList = new clsThemeList();
$Theme = $objThemeList->GetItem($ThemeId);
$theme_name = $Theme->Get("Name");
$sql = "SELECT * FROM $table";
$rs = $ado->Execute($sql);
$found = array();
while($rs && !$rs->EOF)
{
$p = $rs->fields["Phrase"];
if(!in_array($p,$found))
$found[] = $p;
$rs->MoveNext();
}
$subtitle = prompt_language("la_prompt_Theme").": ".$theme_name;
$title = prompt_language("la_Text_Scanning")." ".prompt_language("la_Text_Templates");
int_header(NULL,NULL,$title);
?>
<TABLE cellSpacing="0" cellPadding="2" width="100%" class="tableborder">
<?php int_subsection_title($subtitle); ?>
<?php
if($NumFiles==0)
{
$percent=100;
}
else
{
$percent = (int)(($FileIndex/$NumFiles) * 100);
}
if ($percent == 0)
{
echo "<TR>";
echo "<TD BGCOLOR=\"#FFFFFF\" width=\"100%\" >$percent";
echo "%</td></TR>";
}
else if ($percent < 60)
{
echo "<TR><TD BGCOLOR=\"#4682B2\" width=\"".$percent."%\" >";
$row2 = 100-$percent;
echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" > $percent";
echo "%</td></TR>";
}
else if ($percent == 100)
{
echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"100%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT></td>";
}
else
{
echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"".$percent."%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT>";
$row2 = 100-$percent;
echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" ></td></TR>";
}
$sql = "SELECT * FROM ".$objThemeFiles->SourceTable." WHERE ThemeId=$ThemeId LIMIT $FileIndex,$FilesPerLoad";
$TemplateRoot = $Theme->ThemeDirectory()."/";
$objTemplate = new clsLangParser($TemplateRoot);
$objTemplate->SkipIncludes=1;
//$ForceLanguage = $LangId;
$LogPhraseLookups = TRUE;
$rs = $ado->Execute($sql);
while($rs && !$rs->EOF)
{
$path = "";
$p = $rs->fields["FilePath"];
if(strlen(trim($p)))
$path .= $p."/";
$path .= $rs->fields["FileName"];
$path = substr($path,0,-4);
//echo "Parsing $path <br>\n";
$html = $objTemplate->ParseTemplate($path);
//echo htmlentities($html)."<br>\n";
$rs->MoveNext();
}
if(is_array($MissingList))
{
for($x=0;$x<count($MissingList);$x++)
{
$next = $x + $FileIndex;
if(!in_array($MissingList[$x],$found))
{
$sql = "INSERT INTO $table (PhraseId,Phrase,Translation,PhraseType,LanguageId) VALUES (";
$sql .= $next.",'".$MissingList[$x]."','',1,$LangId)";
//echo $sql."<br>\n";
$ado->Execute($sql);
}
}
}
if($FileIndex >=$NumFiles)
{
$target = $adminURL."/config/missing_label_edit.php?env=".BuildEnv()."&lpn=1";
}
else
{
$next = $FileIndex+$FilesPerLoad;
$target = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&File=".$next."&NumFiles=$NumFiles";
}
?>
</TABLE>
<?php int_footer(); ?>
<?php
flush();
print "<script language=\"javascript\">";
print " location.href='$target';";
print " </script>";
//print "<A HREF=\"$target\">$target</A>";
?>

Event Timeline