Page MenuHomeIn-Portal Phabricator

sql_result.php
No OneTemporary

File Metadata

Created
Tue, Sep 16, 7:37 AM

sql_result.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. ##
##############################################################
if(!strlen($pathtoroot))
{
$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
if(strlen($path))
{
/* determine the OS type for path parsing */
$pos = strpos($path,":");
if ($pos === false)
{
$gOS_TYPE="unix";
$pathchar = "/";
}
else
{
$gOS_TYPE="win";
$pathchar="\\";
}
$p = $path.$pathchar;
/*Start looking for the root flag file */
while(!strlen($pathtoroot) && strlen($p))
{
$sub = substr($p,strlen($pathchar)*-1);
if($sub==$pathchar)
{
$filename = $p."root.flg";
}
else
$filename = $p.$pathchar."root.flg";
if(file_exists($filename))
{
$pathtoroot = $p;
}
else
{
$parent = realpath($p.$pathchar."..".$pathchar);
if($parent!=$p)
{
$p = $parent;
}
else
$p = "";
}
}
if(!strlen($pathtoroot))
$pathtoroot = ".".$pathchar;
}
else
{
$pathtoroot = ".".$pathchar;
}
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if($sub!=$pathchar)
{
$pathtoroot = $pathtoroot.$pathchar;
}
//echo $pathtoroot;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
//$pathtolocal = $pathtoroot."in-news/";
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");
$envar = "env=" . BuildEnv();
$section = 'in-portal:sql_query';
$sec = $objSections->GetSection($section);
$parent = $objSections->GetSection($sec->Get("parent"));
$title = admin_language("la_tab_QueryDB");
//$saveURL = $admin."/browse.php";
$saveURL = $admin."/tools/sql_results.php";
$ParentUrl = $parent->URL();
if(strlen($ParentUrl)>0)
{
$cancelUrl = $ParentUrl;
}
else
$cancelUrl = $_SERVER['PHP_SELF']."?".$envar;
$action = "m_sql_query";
$sql_query = trim($objSession->GetVariable("LastSQLquery"));
//$objCatToolBar = new clsToolBar();
//$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('sqlform','$saveURL',1,'');","tool_select.gif");
//$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('category','$cancelURL',2,'');","tool_cancel.gif");
int_header(NULL,NULL,$title);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<?php int_subsection_title(admin_language("la_prompt_sqlquery_result")); ?>
<tr <?php echo int_table_color(); ?>>
<TD colspan=3>
<?php echo $SqlQuery; ?>
<input class="button" type=button value="<?php echo admin_language("la_prompt_edit_query"); ?>" onclick="history.go(-1);">
</td>
</tr>
<tr>
<?php
if($SqlErrorNum>0)
{
?>
<?php int_subsection_title(admin_language("la_prompt_sqlquery_error")); ?>
<tr <?php echo int_table_color(); ?>>
<TD colspan=3>
<?php echo $SqlError; ?>
</td>
</tr>
<tr>
<?php
}
else
{
$ResultObject = new clsItemCollection();
$ResultObject->classname = "clsItemDB";
echo "<TR><TD colspan=3><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
while($SqlResult && !$SqlResult->EOF)
{
$ResultObject->AddItemFromArray($SqlResult->fields,TRUE);
$SqlResult->MoveNext();
}
$objListView = new clsListView(NULL,$ResultObject);
$fields = $SqlResult->FieldTypesArray();
if(is_array($fields))
{
$width = 100 / count($fields);
$width = "width=\"".$width."%\"";
foreach($fields as $f)
{
$name = $f->name;
$objListView->ColumnHeaders->Add($name,$name,1,0,"",$width,"", "",$name);
}
}
$objListView->PrintToolBar = FALSE;
$objListView->nowrap = FALSE;
$objListView->CurrentPageVar = "";
$objListView->PerPageVar = "";
$objListView->checkboxes=false;
echo $objListView->ColumnHeaders->PrintColumns();
if($ResultObject->NumItems()>0)
{
echo $objListView->PrintItems();
}
echo "</TABLE></TD></TR>";
}
?>
</TABLE>
<?php int_footer(); ?>

Event Timeline