Index: trunk/admin/browse.php
===================================================================
diff -u -r547 -r726
--- trunk/admin/browse.php (.../browse.php) (revision 547)
+++ trunk/admin/browse.php (.../browse.php) (revision 726)
@@ -1,472 +1,943 @@


";
+
+
if(!strlen($pathtoroot))
+
{
+
$path=dirname(realpath(__FILE__));
+
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");
+
+
if (!admin_login())
+
{
+
if(!headers_sent())
+
setcookie("sid"," ",time()-3600);
+
$objSession->Logout();
+
header("Location: ".$adminURL."/login.php");
+
die();
+
//require_once($pathtoroot."admin/login.php");
+
}
+
+
$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";
+
$browseURL = $adminURL."/browse";
+
$cssURL = $adminURL."/include";
+
+
$indexURL = $rootURL."index.php";
+
+
$m_var_list_update["cat"] = 0;
+
$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
+
unset($m_var_list_update["cat"]);
+
+
$envar = "env=" . BuildEnv();
+
+
if($objCatList->CurrentCategoryID()>0)
+
{
+
$c = $objCatList->CurrentCat();
+
$upURL = "javascript:AdminCatNav('".$c->Admin_Parent_Link()."');";
+
}
+
else
+
$upURL = $_SERVER["PHP_SELF"]."?".$envar;
+
+
//admin only util
+
+
$pathtolocal = $pathtoroot."kernel/";
+
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."/browse/toolbar.php");
+
+
$m = GetModuleArray();
+
foreach($m as $key=>$value)
+
{
+
$path = $pathtoroot.$value."admin/include/parser.php";
+
if(file_exists($path))
+
{
+
//echo "";
+
@include_once($path);
+
}
+
}
+
if(!defined('IS_INSTALL'))define('IS_INSTALL',0);
+
if(!IS_INSTALL)
+
{
+
if (!admin_login())
+
{
+
if(!headers_sent())
+
setcookie("sid"," ",time()-3600);
+
$objSession->Logout();
+
header("Location: ".$adminURL."/login.php");
+
die();
+
//require_once($pathtoroot."admin/login.php");
+
}
+
}
+
//Set Section
+
$section = 'in-portal:browse';
+
+
//Set Environment Variable
+
+
//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard
\n";
+
//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard
\n";
+
//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard
\n";
+
//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard
\n";
+
+
// save last category visited
+
$objSession->SetVariable('prev_category', $objSession->GetVariable('last_category') );
+
$objSession->SetVariable('last_category', $objCatList->CurrentCategoryID() );
+
+
/* // for testing
+
$last_cat = $objSession->GetVariable('last_category');
+
$prev_cat = $objSession->GetVariable('prev_category');
+
echo "Last CAT: [$last_cat]
";
+
echo "Prev CAT: [$prev_cat]
";
+
*/
+
$SearchType = $objSession->GetVariable("SearchType");
+
if(!strlen($SearchType))
+
$SearchType = "all";
+
$SearchLabel = "la_SearchLabel";
if( GetVar('SearchWord') !== false ) $objSession->SetVariable('admin_seach_words', GetVar('SearchWord') );
+
$SearchWord = $objSession->GetVariable('admin_seach_words');
+
+
$objSession->SetVariable("HasChanges", 0);
+
+
// where should all edit popups submit changes
+
$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
+
/* page header */
+
print <<
+
+
In-portal
+
+
+
+
+
END;
+
+
require_once($pathtoroot.$admin."/include/mainscript.php");
+
+
print <<
+
if (window.opener != null) {
+
theMainScript.CloseAndRefreshParent();
+
}
+
+
END;
+
+
print <<
+
+
+
+
+
+
END;
+
load_module_styles();
+
if( !isset($list) ) $list = '';
+
if(($SearchType=="categories" || $SearchType="all") && strlen($list))
+
{
+
int_SectionHeader(NULL,NULL,NULL,admin_language("la_Title_SearchResults"));
+
}
+
else
+
int_SectionHeader();
+
+
$filter = false; // always initialize variables before use
+
+
if($objSession->GetVariable("SearchWord") != '') {
+
$filter = true;
+
}
+
else {
+
$bit_combo = $objModules->ExecuteFunction('GetModuleInfo', 'all_bitmask');
+
$bit_combo = $objModules->MergeReturn($bit_combo);
+
foreach($bit_combo['VarName'] as $mod_name => $VarName)
+
{
+
//echo "VarName: [$VarName] = [".$objConfig->Get($VarName)."], ALL = [".$bit_combo['Bits'][$mod_name]."]
";
+
if( $objConfig->Get($VarName) )
+
if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] )
+
{
+
$filter = true;
+
break;
+
}
+
}
+
}
+
?>
+
+
+
+
+
+
+
+
+
|
+
+
+
+
|
+
+
+
+
+
+
+
+
+
QueryOrderByClause(TRUE,TRUE,TRUE);
+
$objCatList->Clear();
+
$IsSearch = FALSE;
+
if($SearchType == 'categories' || $SearchType == 'all')
+
{
+
$list = $objSession->GetVariable("SearchWord");
+
$SearchQuery = $objCatList->AdminSearchWhereClause($list);
+
if(strlen($SearchQuery))
+
{
+
$SearchQuery = " (".$SearchQuery.") ";
- if( strlen($CatScopeClause) ) $SearchQuery .= " AND ".$CatScopeClause;
+
+ if( strlen($CatScopeClause) ) {
+ $SearchQuery .= " AND ParentId = ".$objCatList->CurrentCategoryID();//" AND ".$CatScopeClause;
+ }
+
$objCatList->LoadCategories($SearchQuery.$CategoryFilter,$OrderBy);
+
$IsSearch = TRUE;
+
}
+
else
+
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter,$OrderBy);
+
}
+
else
+
$objCatList->LoadCategories("ParentId=".$objCatList->CurrentCategoryID()." ".$CategoryFilter, $OrderBy);
+
+
$TotalItemCount += $objCatList->QueryItemCount;
+
+
?>
+
GetAdminUserErrors();
+
if(count($e)>0)
+
{
+
echo "";
+
for($ex = 0; $ex".prompt_language($e[$ex])." | ";
+
}
+
echo "
";
+
}
+
?>
+
+
+
+
+
+
+
+
+
|
+
+
:
+
|
+
+
(QueryItemCount; ?>)
+
|
+
+
+
|
+
+
+
|
+
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
TabRow();
+
if(count($ItemTabs->Tabs))
+
{
+
?>
+
+
+
+
$value)
+
{
+
$path = $pathtoroot.$value."admin/browse.php";
+
if(file_exists($path))
+
{
+
//echo "\n\n";
+
include_once($path);
+
}
+
}
+
?>
+
+
+
+
-
+
+
+
\ No newline at end of file