Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1161027
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 19, 10:27 PM
Size
38 KB
Mime Type
text/x-diff
Expires
Sun, Sep 21, 10:27 PM (5 h, 23 m)
Engine
blob
Format
Raw Data
Handle
750984
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php
===================================================================
--- branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php (revision 5442)
@@ -0,0 +1,687 @@
+<?php
+
+define('FT_OPTION', 1); // option formatter
+
+class clsItemDB
+{
+ var $Formatters = Array(); // by Alex
+ var $m_dirtyFieldsMap = array();
+ var $Data = array();
+ var $adodbConnection;
+ var $tablename;
+ var $BasePermission;
+ var $id_field;
+ var $NoResourceId;
+ var $debuglevel;
+
+ var $Prefix = '';
+ var $Special = '';
+
+ var $SelectSQL = 'SELECT * FROM %s WHERE %s';
+
+ /**
+ * Application object
+ *
+ * @var kApplication
+ */
+ var $Application = null;
+
+ /**
+ * Connection to database
+ *
+ * @var kDBConnection
+ */
+ var $Conn = null;
+
+ function clsItemDB()
+ {
+ if (class_exists('kApplication')) {
+ // just in case when aplication is not found
+ $this->Application =& kApplication::Instance();
+ $this->Conn =& $this->Application->GetADODBConnection();
+ }
+
+ $this->adodbConnection = &GetADODBConnection();
+ $this->tablename="";
+ $this->NoResourceId=0;
+ $this->debuglevel=0;
+ }
+
+ // ============================================================================================
+ function GetFormatter($field)
+ {
+ return $this->HasFormatter($field) ? $this->Formatters[$field] : false;
+ }
+
+ function isLiveTable()
+ {
+ global $objSession;
+ return !preg_match('/'.GetTablePrefix().'ses_'.$objSession->GetSessionKey().'_edit_(.*)/', $this->tablename);
+ }
+
+ function SetFormatter($field, $type, $params)
+ {
+ // by Alex
+ // all params after 2nd are formmater type specific
+ $this->Formatters[$field]['type'] = $type;
+ switch($type)
+ {
+ case FT_OPTION:
+ $this->Formatters[$field]['options'] = $params;
+ break;
+ }
+ }
+ /*
+ function FormatFields()
+ {
+ // format item in list data before printing
+
+ foreach($this->Formatters as $field => $formatter)
+ $this->Data[$field] = $this->FormatField($field);
+ }
+ */
+ function FormatField($field)
+ {
+ // formats single field if it has formatter
+ if( $this->HasFormatter($field) )
+ {
+ $fmt = $this->Formatters[$field];
+ switch($fmt['type'])
+ {
+ case FT_OPTION:
+ return $fmt['options'][ $this->Data[$field] ];
+ break;
+ }
+ }
+ else
+ return $this->Get($field);
+ }
+
+ function HasFormatter($field)
+ {
+ // checks if formatter is set for field
+ return isset($this->Formatters[$field]) ? 1 : 0;
+ }
+ // ============================================================================================
+
+ function UnsetIdField()
+ {
+ $f = $this->IdField();
+ unset($this->Data[$f]);
+ unset($this->m_dirtyFieldsMap[$f]);
+ }
+
+ function UnsetField($field)
+ {
+ unset($this->Data[$field]);
+ unset($this->m_dirtyFieldsMap[$field]);
+ }
+
+ function IdField()
+ {
+ if(!strlen($this->id_field))
+ {
+ return $this->tablename."Id";
+ }
+ else
+ return $this->id_field;
+ }
+
+ function UniqueId()
+ {
+ return $this->Get($this->IdField());
+ }
+
+ function SetUniqueId($value)
+ {
+ $var = $this->IdField();
+
+ if( $this->UsingTempTable() ) $value = $this->UniqueId();
+
+ $this->Set($var, $value);
+ }
+
+ function SetModified($UserId=NULL,$modificationDate=null)
+ {
+ global $objSession;
+
+ $keys = array_keys($this->Data);
+ if(in_array("Modified",$keys))
+ {
+ $this->Set("Modified", isset($modificationDate) ? $modificationDate : adodb_date("U") );
+ }
+ if(in_array("ModifiedById",$keys))
+ {
+ if(!$UserId)
+ $UserId = $objSession->Get("PortalUserId");
+ $this->Set("ModifiedById",$UserId);
+ }
+ }
+
+ function PrintVars()
+ {
+ echo '<pre>'.print_r($this->Data, true).'</pre>';
+ }
+
+// =================================================================
+ function GetFormatted($name)
+ {
+ // get formatted field value
+ return $this->FormatField($name);
+ }
+
+ function Get($name)
+ {
+ // get un-formatted field value
+ //if( !isset($this->Data[$name]) ) print_pre( debug_backtrace() );
+ return $this->HasField($name) ? $this->Data[$name] : '';
+ }
+// =================================================================
+
+ function HasField($name)
+ {
+ // checks if field exists in item
+ return isset($this->Data[$name]) ? 1 : 0;
+ }
+
+ /**
+ * Set's value(-s) of field(-s) specified.
+ * Modifies HasChanges flag automatically.
+ *
+ * @param string/array $name
+ * @param string/array $value
+ * @access public
+ */
+ function Set($name, $value)
+ {
+ //echo "Setting Field <b>$name</b>: = [$value]<br>";
+ if( is_array($name) )
+ {
+ for ($i=0; $i < sizeof($name); $i++)
+ {
+ $this->_Set($name[$i],$value[$i]);
+ }
+ }
+ else
+ {
+ $this->_Set($name,$value);
+ }
+ }
+
+
+ /**
+ * Set's value(-s) of field(-s) specified.
+ * Modifies HasChanges flag automatically.
+ *
+ * @param string $name
+ * @param string $value
+ * @access private
+ */
+ function _Set($name,$value)
+ {
+ $var = 'm_'.$name;
+ if( !$this->HasField($name) || $this->Data[$name] != $value )
+ {
+ if( !(isset($_GET['new']) && $_GET['new']) ) {
+ $this->DetectChanges($name, $value);
+ }
+ $this->Data[$name] = $value;
+ $this->m_dirtyFieldsMap[$name] = $value;
+ }
+ }
+
+ function Dirty($list=NULL)
+ {
+ if($list==NULL)
+ {
+ foreach($this->Data as $field => $value)
+ {
+ $this->m_dirtyFieldsMap[$field] = $value;
+ }
+ }
+ else
+ {
+ foreach($list as $field)
+ {
+ $this->m_dirtyFieldsMap[$field] = $this->Data[$field];
+ }
+ }
+ }
+
+ function Clean($list=NULL)
+ {
+ if($list == NULL)
+ {
+ unset($this->m_dirtyFieldsMap);
+ $this->m_dirtyFieldsMap=array();
+ }
+ else
+ {
+ foreach($list as $value)
+ {
+ $varname = "m_" . $value;
+ unset($this->m_dirtyFieldsMap[$value]);
+ }
+ }
+ }
+
+ function SetDebugLevel($value)
+ {
+ $this->debuglevel = $value;
+ }
+
+ function SetFromArray($data, $dirty = false)
+ {
+ if(is_array($data))
+ {
+ $this->Data = $data;
+ if($dirty) $this->m_dirtyFieldsMap = $data;
+ }
+ }
+
+ function GetData()
+ {
+ return $this->Data;
+ }
+
+ function SetData($data, $dirty = false)
+ {
+ $this->SetFromArray($data, $dirty);
+ }
+
+ function Delete()
+ {
+ global $Errors;
+
+ if($this->Get($this->IdField())==0)
+ {
+ $Errors->AddError("error.AppError",NULL,'Internal error: Delete requires set id',"",get_class($this),"Delete");
+ return false;
+ }
+
+ $sql = sprintf('DELETE FROM %s WHERE %s = %s', $this->tablename, $this->IdField(),
+ $this->UniqueId());
+ if($this->debuglevel>0)
+ echo $sql."<br>";
+ if ($this->adodbConnection->Execute($sql) === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Delete");
+ return false;
+ }
+ return true;
+ }
+
+ function Update($UpdatedBy=NULL,$modificationDate = null)
+ {
+ global $Errors, $objSession;
+
+ if( !$this->raiseEvent('OnBeforeItemUpdate') ) return false;
+
+ if( count($this->m_dirtyFieldsMap) == 0 ) return true;
+
+ $this->SetModified($UpdatedBy, $modificationDate);
+ $sql = 'UPDATE '.$this->tablename .' SET ';
+
+ foreach ($this->m_dirtyFieldsMap as $key => $value)
+ {
+ if(!is_numeric($key) && $key != $this->IdField() && $key!='ResourceId')
+ {
+ if( is_null($value) )
+ {
+ $value = 'NULL';
+ }
+ else
+ {
+ $value = $this->adodbConnection->qstr( isset($GLOBALS['_CopyFromEditTable']) ? $value : stripslashes($value) );
+ }
+ $sql .= '`'.$key.'` = '.$value.', ';
+ }
+ }
+ $sql = preg_replace('/(.*), $/','\\1',$sql);
+
+ $sql .= ' WHERE '.$this->IdField().' = '.$this->adodbConnection->qstr( $this->UniqueId() );
+
+ if( $this->debuglevel > 0 ) echo $sql.'<br>';
+ if( $this->adodbConnection->Execute($sql) === false )
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Update");
+ return false;
+ }
+
+ if( $objSession->GetVariable('HasChanges') == 2 ) $objSession->SetVariable('HasChanges', 1);
+
+ $this->raiseEvent('OnAfterItemUpdate');
+
+ return true;
+ }
+
+ function ReplaceID($new_id)
+ {
+ // replace item's id, because Update method
+ // is too dummy to do this autommatically
+ // USED in temporary table editing stuff
+ $db =& $this->adodbConnection;
+ $sql = "UPDATE %1\$s SET `%2\$s` = %3\$s WHERE `%2\$s` = %4\$s";
+ $sql = sprintf($sql, $this->tablename, $this->IdField(), $new_id, (int)$this->UniqueId() );
+ if($this->debuglevel > 0) echo $sql.'<br>';
+ $db->Execute($sql);
+ }
+
+ function CreateSQL()
+ {
+ global $Errors;
+
+ $sql = "INSERT IGNORE INTO ".$this->tablename." (";
+ $first = 1;
+ foreach ($this->Data as $key => $value)
+ {
+ if($first)
+ {
+ $sql = sprintf("%s %s",$sql,$key);
+ $first = 0;
+ }
+ else
+ {
+ $sql = sprintf("%s, %s",$sql,$key);
+ }
+ }
+ $sql = sprintf('%s ) VALUES (',$sql);
+ $first = 1;
+ foreach ($this->Data as $key => $value)
+ {
+ if( is_array($value) )
+ {
+ global $debugger;
+ $debugger->dumpVars($value);
+ $debugger->appendTrace();
+ trigger_error('Value of array type not allowed in method <b>CreateSQL</b> of <b>clsItemDB</b> class', E_USER_ERROR);
+ }
+ if($first)
+ {
+ if(isset($GLOBALS['_CopyFromEditTable']))
+ $sql = sprintf("%s %s",$sql,$this->adodbConnection->qstr(($value)));
+ else
+ $sql = sprintf("%s %s",$sql,$this->adodbConnection->qstr(stripslashes($value)));
+ $first = 0;
+ }
+ else
+ {
+ if(isset($GLOBALS['_CopyFromEditTable']))
+ $sql = sprintf("%s, %s",$sql,$this->adodbConnection->qstr(($value)));
+ else
+ $sql = sprintf("%s, %s",$sql,$this->adodbConnection->qstr(stripslashes($value)));
+ }
+ }
+ $sql = sprintf('%s)',$sql);
+
+ return $sql;
+ }
+
+ /**
+ * Set's HasChanges flag based on new field
+ * with $name with value $value.
+ *
+ * @param string $name
+ * @param string $value
+ * @access private
+ */
+ function DetectChanges($name, $value)
+ {
+ global $objSession;
+ if( !is_object($objSession) ) return false;
+
+ //echo "<b>class: ".get_class($this)."</b><br>";
+ if (!isset($this->Data[$name]) ) return false;
+
+ if ( getArrayValue($this->Data, $name) != $value && $value != '') {
+ //echo "$name Modified tt ".$this->Data[$name]." tt $value<br>";
+ if ($objSession->GetVariable("HasChanges") != 1) {
+ $objSession->SetVariable("HasChanges", 2);
+ }
+ }
+ }
+
+ function Create()
+ {
+ global $Errors, $objSession;
+
+ if( !$this->raiseEvent('OnBeforeItemCreate') ) return false;
+
+ if($this->debuglevel) echo "Creating Item: ".get_class($this)."<br>";
+ if($this->NoResourceId!=1 && (int)$this->Get("ResourceId")==0)
+ {
+ $this->Set("ResourceId", GetNextResourceId());
+ }
+ $sql = $this->CreateSql();
+
+ if($this->debuglevel>0)
+ echo $sql."<br>\n";
+
+ if ($this->adodbConnection->Execute($sql) === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Create");
+ return false;
+ }
+
+ $this->SetUniqueId($this->adodbConnection->Insert_ID());
+
+ if ($objSession->GetVariable("HasChanges") == 2) {
+ $objSession->SetVariable("HasChanges", 1);
+ }
+
+ /*if ($this->adodbConnection->Affected_Rows() > 0) {
+ $objSession->SetVariable("HasChanges", 1);
+ } */
+
+ $this->raiseEvent('OnAfterItemCreate');
+
+ return true;
+ }
+
+ function Increment($field, $calculate_hot = false)
+ {
+ global $Errors;
+
+ if ($calculate_hot) {
+ $sql = "SELECT $field FROM ".$this->tablename." WHERE ".$this->IdField()." = ".$this->UniqueId();
+ $rs = $this->adodbConnection->Execute($sql);
+
+ $sql = "SELECT MAX($field) AS max_value FROM ".$this->tablename." WHERE ROUND($field) = ".round($rs->fields[$field]);
+ $rs = $this->adodbConnection->Execute($sql);
+ //echo "MAX VALUE: ".$rs->fields['max_value']."<br>";
+ //echo "MAX SQL: $sql<br>";
+ $new_val = $rs->fields['max_value'] + 1;
+
+ $sql = "SELECT count($field) AS count FROM ".$this->tablename." WHERE $field = $new_val";
+ $rsc = $this->adodbConnection->Execute($sql);
+
+ while ($rsc->fields['count'] != 0) {
+ $sql = "SELECT count($field) AS count FROM ".$this->tablename." WHERE $field = $new_val";
+ $rsc = $this->adodbConnection->Execute($sql);
+ //echo "New Value:$new_val<br>";
+ if ($rsc->fields['count'] > 0) {
+ $new_val = $new_val + 0.000001;
+ }
+ }
+
+ $sql = "Update ".$this->tablename." set $field=$new_val where ".$this->IdField()."=" . $this->UniqueId();
+ }
+ else {
+ $sql = "Update ".$this->tablename." set $field=$field+1 where ".$this->IdField()."=" . $this->UniqueId();
+ }
+ if($this->debuglevel>0)
+ echo $sql."<br>";
+ $result = $this->adodbConnection->Execute($sql);
+ if ($result === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Increment");
+ return false;
+ }
+
+ if ($calculate_hot) {
+ $this->Set($field,$new_val);
+ }
+ else {
+ $this->Set($field, $this->Get($field) + 1);
+ }
+ }
+
+ function Decrement($field)
+ {
+ global $Errors;
+
+ $sql = "Update ".$this->tablename." set $field=$field-1 where ".$this->IdField()."=" .(int)$this->UniqueId();
+ if($this->debuglevel>0)
+ echo $sql;
+ $result = $this->adodbConnection->Execute($sql);
+ if ($result === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Decrement");
+ return false;
+ }
+ $this->Set($field,$this->Get($field)-1);
+ }
+
+ function GetFieldList($UseLoadedData=FALSE)
+ {
+ if(count($this->Data) && $UseLoadedData==TRUE)
+ {
+ $res = array_keys($this->Data);
+ }
+ else
+ {
+ $res = $this->adodbConnection->MetaColumnNames($this->tablename);
+ }
+ return $res;
+ }
+
+ function UsingTempTable()
+ {
+ global $objSession;
+
+ $temp = $objSession->GetEditTable($this->tablename);
+ $p = GetTablePrefix()."ses";
+ $t = substr($temp,0,strlen($p));
+ $ThisTable = substr($this->tablename,0,strlen($p));
+ if($t==$ThisTable)
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ function LoadFromDatabase($Id, $IdField = null) // custom IdField by Alex
+ {
+ global $objSession,$Errors;
+
+ if(!isset($Id))
+ {
+ $Errors->AddError("error.AppError",NULL,'Internal error: LoadFromDatabase id',"",get_class($this),"LoadFromDatabase");
+ return false;
+ }
+
+ // --------- multiple ids allowed: begin -----------------
+ $id_field = isset($IdField) ? $IdField : $this->IdField();
+ if( !is_array($id_field) ) $id_field = Array($id_field);
+ if( !is_array($Id) ) $Id = Array($Id);
+
+ $i = 0; $id_count = count($id_field);
+ $conditions = Array();
+ while($i < $id_count)
+ {
+ $conditions[] = "(`".$id_field[$i]."` = '".$Id[$i]."')";
+ $i++;
+ }
+ $sql = sprintf($this->SelectSQL, $this->tablename, implode(' AND ', $conditions) );
+ // --------- multiple ids allowed: end --------------------
+ if($this->debuglevel) echo "Load SQL: $sql<br>";
+ $result = $this->adodbConnection->Execute($sql);
+ if ($result === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"LoadFromDatabase");
+ return false;
+ }
+ $data = $result->fields;
+ if($this->debuglevel) print_pre($data);
+ if(is_array($data))
+ $this->SetFromArray($data);
+ $this->Clean();
+ return TRUE;
+ }
+
+ function FieldExists($field)
+ {
+ $res = array_key_exists($field,$this->Data);
+ return $res;
+ }
+
+ function ValueExists($Field,$Value)
+ {
+ $sql = "SELECT $Field FROM ".$this->tablename." WHERE $Field='$Value'";
+ $rs = $this->adodbConnection->Execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ function FieldMax($Field)
+ {
+ $sql = "SELECT Max($Field) as m FROM ".$this->tablename;
+ $rs = $this->adodbConnection->Execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ $ret = $rs->fields["m"];
+ }
+ else
+ $ret = 0;
+ }
+
+ function FieldMin($Field)
+ {
+ $sql = "SELECT Min($Field) as m FROM ".$this->tablename;
+ $rs = $this->adodbConnection->Execute($sql);
+ if($rs && !$rs->EOF)
+ {
+ $ret = $rs->fields["m"];
+ }
+ else
+ $ret = 0;
+ }
+
+ function TableExists($table = null)
+ {
+ // checks if table specified in item exists in db
+ $db =& GetADODBConnection();
+ $sql = "SHOW TABLES LIKE '%s'";
+ if($table == null) $table = $this->tablename;
+ $rs = $db->Execute( sprintf($sql, $table) );
+
+ if( $rs->RecordCount() == 1 ) // table exists in normal case
+ return 1;
+ else // check if table exists in lowercase
+ $rs = $db->Execute( sprintf($sql, strtolower($table) ) );
+
+ return ($rs->RecordCount() == 1) ? 1 : 0;
+ }
+
+ function raiseEvent($name, $id = null)
+ {
+ return true;
+
+ /*if (!getArrayValue($GLOBALS, '_CopyFromEditTable')) {
+ return true;
+ }
+
+ if( !isset($id) ) $id = $this->GetID();
+ $event = new kEvent( Array('name'=>$name,'prefix'=>$this->Prefix,'special'=>$this->Special) );
+ $event->setEventParam('id', $id);
+ $this->Application->HandleEvent($event);
+ return $event->status == erSUCCESS ? true : false;*/
+ }
+
+}
+?>
Property changes on: branches/unlabeled/unlabeled-1.35.2/kernel/include/itemdb.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.35
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.35.2/admin/browse.php
===================================================================
--- branches/unlabeled/unlabeled-1.35.2/admin/browse.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.35.2/admin/browse.php (revision 5442)
@@ -0,0 +1,450 @@
+<?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. ##
+##############################################################
+
+function k4getmicrotime()
+{
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+
+$start = k4getmicrotime();
+
+// new startup: begin
+define('REL_PATH', 'admin');
+$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
+
+checkViewPermission('in-portal:browse');
+if($application->GetVar('Action') == 'm_paste') define('REDIRECT_REQUIRED',1); // this script can issue redirect header
+
+define('REQUIRE_LAYER_HEADER', 1);
+$b_topmargin = "0";
+//$b_header_addon = "<DIV style='position:relative; z-Index: 1; background-color: #ffffff; padding-top:1px;'><div style='position:absolute; width:100%;top:0px;' align='right'><img src='images/logo_bg.gif'></div><img src='images/spacer.gif' width=1 height=15><br><div style='z-Index:1; position:relative'>";
+
+require_login();
+
+$indexURL = $rootURL."index.php";
+$homeURL = "javascript:AdminCatNav('".$_SERVER["PHP_SELF"]."?env=".BuildEnv()."');";
+
+$m_var_list_update["cat"] = 0;
+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 "<!-- $path -->";
+ @include_once($path);
+ }
+}
+
+$cat_templates = $objModules->ExecuteFunction('GetModuleInfo', 'catalog_template');
+foreach ($cat_templates as $a_mod => $a_template) {
+ if (!$a_template) continue;
+
+ $module_prefix = $application->findModule('Name', $a_mod, 'Var');
+ $view_perm = $application->getUnitOption($module_prefix, 'PermItemPrefix').'.VIEW';
+ if ($application->CheckPermission($view_perm, 0)) {
+ $a_var = $a_mod.'_TAB_HTML';
+ $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true);
+ }
+}
+
+//$application->SetVar('t', 'in-commerce/products/products_catalog');
+
+
+if( !defined('IS_INSTALL') ) define('IS_INSTALL', 0);
+if( !IS_INSTALL ) require_login();
+
+//Set Section
+$section = 'in-portal:browse';
+
+//Set Environment Variable
+
+//echo $objCatList->ItemsOnClipboard()." Categories on the clipboard<br>\n";
+//echo $objTopicList->ItemsOnClipboard()." Topics on the clipboard<br>\n";
+//echo $objLinkList->ItemsOnClipboard()." Links on the clipboard<br>\n";
+//echo $objArticleList->ItemsOnClipboard()." Articles on the clipboard<br>\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]<br>";
+echo "Prev CAT: [$prev_cat]<br>";
+*/
+$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');
+
+// where should all edit popups submit changes
+$objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) );
+$charset = GetRegionalOption('Charset');
+
+$base_href = $application->ProcessParsedTag('m', 'Base_Ref', Array());
+
+/* page header */
+print <<<END
+<html>
+<head>
+ <title>In-portal</title>
+ $base_href
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
+ <meta http-equiv="Pragma" content="no-cache">
+ <script language="JavaScript">
+ imagesPath='$imagesURL'+'/';
+ </script>
+
+END;
+
+ require_once($pathtoroot.$admin."/include/mainscript.php");
+
+print <<<END
+<script type="text/javascript">
+ if (window.opener != null) {
+ theMainScript.CloseAndRefreshParent();
+ }
+</script>
+END;
+
+print <<<END
+ <script src="$browseURL/toolbar.js"></script>
+ <script src="$browseURL/checkboxes_new.js"></script>
+ <script language="JavaScript1.2" src="$browseURL/fw_menu.js"></script>
+ <script language="javascript" src="incs/script.js"></script>
+ <link rel="stylesheet" type="text/css" href="$browseURL/checkboxes.css">
+ <link rel="stylesheet" type="text/css" href="$cssURL/style.css">
+ <link rel="stylesheet" type="text/css" href="$browseURL/toolbar.css">
+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]."]<br>";
+ if( $objConfig->Get($VarName) )
+ if( $objConfig->Get($VarName) != $bit_combo['Bits'][$mod_name] )
+ {
+ $filter = true;
+ break;
+ }
+ }
+}
+?>
+</div>
+<!-- alex mark -->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+ <tbody>
+ <tr>
+ <td>
+ <div name="toolBar" id="mainToolBar">
+ <tb:button action="upcat" title="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="homecat" title="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="new_cat" title="<?php echo admin_language("la_ToolTip_New_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="editcat" title="<?php echo admin_language("la_ToolTip_Edit_Current_Category"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+
+ <?php
+ foreach($NewButtons as $btn)
+ {
+ print '<tb:button action="'.$btn['Action'].'" title="'.$btn['Alt'].'" ImagePath="'.$btn['ImagePath'].'" ';
+ if (getArrayValue($btn, 'Tab')) print 'tab="'.$btn['Tab'].'"';
+ print ">\n";
+ }
+ ?>
+
+ <tb:button action="edit" title="<?php echo admin_language("la_ToolTip_Edit"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="delete" title="<?php echo admin_language("la_ToolTip_Delete"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="approve" title="<?php echo admin_language("la_ToolTip_Approve"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="decline" title="<?php echo admin_language("la_ToolTip_Decline"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+
+ <tb:button action="export" title="<?php echo admin_language("la_ToolTip_Export"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+
+ <tb:button action="rebuild_cache" title="<?php echo admin_language("la_ToolTip_RebuildCategoryCache"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+
+ <tb:button action="cut" title="<?php echo admin_language("la_ToolTip_Cut"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="copy" title="<?php echo admin_language("la_ToolTip_Copy"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="paste" title="<?php echo admin_language("la_ToolTip_Paste"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="move_up" title="<?php echo admin_language("la_ToolTip_Move_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="move_down" title="<?php echo admin_language("la_ToolTip_Move_Down"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="print" title="<?php echo admin_language("la_ToolTip_Print"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="view" title="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ </div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#e0e0da" border="0" class="tableborder_full_a">
+ <tbody>
+ <tr>
+ <td><img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
+ <span class="navbar"><?php $attribs["admin"]=1; print m_navbar($attribs); ?></span>
+ </td>
+ <td align="right">
+ <FORM METHOD="POST" ACTION="<?php echo $_SERVER["PHP_SELF"]."?".$envar; ?>" NAME="admin_search" ID="admin_search"><INPUT ID="SearchScope" NAME="SearchScope" type="hidden" VALUE="<?php echo $objSession->GetVariable("SearchScope"); ?>"><INPUT ID="SearchType" NAME="SearchType" TYPE="hidden" VALUE="<?php echo $objSession->GetVariable("SearchType"); ?>"><INPUT ID="NewSearch" NAME="NewSearch" TYPE="hidden" VALUE="0"><INPUT TYPE="HIDDEN" NAME="Action" value="m_Exec_Search">
+ <table cellspacing="0" cellpadding="0"><tr>
+ <td><?php echo admin_language($SearchLabel); ?> </td>
+ <td><input ID="SearchWord" type="text" value="<?php echo inp_htmlize($SearchWord,1); ?>" name="SearchWord" size="10" style="border-width: 1; border-style: solid; border-color: 999999"></td>
+ <td><img id="imgSearch" action="search_b" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif" title="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search.gif'" style="cursor:hand" width="22" width="22"><!--<img action="search_a" title="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="this.action = this.getAttribute('action'); actionHandler(this);" src="<?php echo $imagesURL."/toolbar/";?>/arrow16.gif" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'" style="cursor:hand">-->
+ <img action="search_c" src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif" title="<?php echo admin_language("la_ToolTip_Search"); ?>" align="absMiddle" onclick="document.all.SearchWord.value = ''; this.action = this.getAttribute('action'); actionHandler(this);" onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset_f2.gif'" onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif'" style="cursor:hand" width="22" width="22">
+ </td>
+ </tr></table>
+ </FORM>
+ <!--tb:button action="search_b" title="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
+ <tb:button action="search_a" title="<?php echo admin_language("la_ToolTip_Search"); ?>" align="right" ImagePath="<?php echo $imagesURL."/toolbar/";?>"-->
+ </td>
+ </tr>
+ </tbody>
+</table>
+<?php if ($filter) { ?>
+<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
+ <tr>
+ <td valign="top">
+ <?php int_hint_red(admin_language("la_Warning_Filter")); ?>
+ </td>
+ </tr>
+</table>
+<?php } ?>
+<br>
+ <!-- CATEGORY DIVIDER -->
+<?php
+
+ $OrderBy = $objCatList->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 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;
+
+?>
+<?php
+ $e = $Errors->GetAdminUserErrors();
+ if(count($e)>0)
+ {
+ echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\">";
+ for($ex = 0; $ex<count($e);$ex++)
+ {
+ echo "<tr><td width=\100%\" class=\"error\">".prompt_language($e[$ex])."</td></tr>";
+ }
+ echo "</TABLE><br>";
+ }
+?>
+<table cellspacing="0" cellpadding="0" width="100%" border="0">
+ <tbody>
+ <tr>
+ <td width="138" height="20" nowrap="nowrap" class="active_tab" onclick="toggleCategoriesB(this)" id="cats_tab">
+ <table cellspacing="0" cellpadding="0" width="100%" border="0">
+ <tr>
+ <td id="l_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_l.gif" class="left_tab">
+ <img src="<?php echo $imagesURL; ?>/itemtabs/divider_up.gif" width="20" height="20" border="0" align="absmiddle">
+ </td>
+ <td id="m_cat" nowrap background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
+ <?php echo admin_language("la_ItemTab_Categories"); ?>:
+ </td>
+ <td id="m1_cat" align="right" valign="top" background="<?php echo $imagesURL; ?>/itemtabs/tab_active.gif" class="tab_class">
+ <span class="cats_stats">(<?php echo $objCatList->QueryItemCount; ?>)</span>
+ </td>
+ <td id="r_cat" background="<?php echo $imagesURL; ?>/itemtabs/tab_active_r.gif" class="right_tab">
+ <img src="<?php echo $imagesURL; ?>/spacer.gif" width="21" height="20">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+<div class="divider" style="" id="categoriesDevider"><img width="1" height="1" src="<?php echo $imagesURL; ?>/spacer.gif"></div>
+</DIV>
+</div>
+<DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:0" id="firstContainer">
+ <DIV style="background-color: #ffffff; position: relative; padding-top: 1px; top: -1px; z-Index:2" id="secondContainer">
+ <!-- CATEGORY OUTPUT START -->
+ <div id="categories" tabtitle="Categories">
+ <form id="categories_form" name="categories_form" action="" method="post">
+ <input type="hidden" name="Action">
+ <?php
+ if($IsSearch)
+ {
+ $template = "cat_search_element.tpl";
+ }
+ else {
+ $template = "cat_element.tpl";
+ }
+ print adListSubCats($objCatList->CurrentCategoryID(),$template);
+ ?>
+ </form>
+ </div>
+ <BR>
+ <!-- CATEGORY OUTPUT END -->
+ <?php
+ print $ItemTabs->TabRow();
+ if(count($ItemTabs->Tabs))
+ {
+ ?>
+ <div class="divider" id="tabsDevider"><img width=1 height=1 src="images/spacer.gif"></div>
+ <?php
+ }
+ ?>
+ </DIV>
+ <?php
+ unset($m);
+
+ //echo $application->ParseBlock(Array('name'=>'kernel_form_start'), 0, true);
+
+ $m = GetModuleArray("admin");
+ foreach($m as $key=>$value)
+ {
+ $path = $pathtoroot.$value."admin/browse.php";
+ if(file_exists($path))
+ {
+ //echo "\n<!-- $path -->\n";
+ include_once($path);
+ }
+ }
+
+ //echo $application->ParseBlock(Array('name'=>'kernel_form_end'), 0, true);
+
+
+ $admin = $objConfig->Get("AdminDirectory");
+ if(!strlen($admin)) $admin = "admin";
+ ?>
+ <form method="post" action="<?php echo $rootURL.$admin; ?>/browse.php?env=<?php echo BuildEnv(); ?>" name="viewmenu">
+ <input type="hidden" name="fieldname" value="">
+ <input type="hidden" name="varvalue" value="">
+ <input type="hidden" name="varvalue2" value="">
+ <input type="hidden" name="Action" value="">
+ </form>
+</DIV>
+<!-- END CODE-->
+<script language="JavaScript">
+ InitPage();
+
+
+ cats_on = theMainScript.GetCookie('cats_tab_on');
+ if (cats_on == 0) {
+ toggleCategoriesB(document.getElementById('cats_tab'), true);
+ }
+
+ tabs_on = theMainScript.GetCookie('tabs_on');
+ if (tabs_on == '1' || tabs_on == null) {
+ if(default_tab.length == 0 || default_tab == 'categories' )
+ {
+ cookie_start = theMainScript.GetCookie('active_tab');
+ if (cookie_start != null) start_tab = cookie_start;
+ if(start_tab!=null) {
+ //alert('ok');
+ toggleTabB(start_tab, true);
+ }
+ }
+ else
+ {
+ //alert('ok');
+ toggleTabB(default_tab,true);
+ }
+ }
+
+ d = document.getElementById('SearchWord');
+ if(d)
+ {
+ d.onkeyup = function(event) {
+ if(window.event.keyCode==13)
+ {
+ var el = document.getElementById('imgSearch');
+ el.onclick();
+ }
+ }
+ }
+
+ <?php
+ if ($application->RecallVar('refresh_tree')) {
+ $application->RemoveVar('refresh_tree');
+ echo 'var $tree_frame = window.parent.getFrame("menu");';
+ echo '$tree_frame.location = $tree_frame.location;';
+ }
+
+ ?>
+</script>
+
+<?php
+ $objSession->SetVariable("HasChanges", 0);
+ int_footer();
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.35.2/admin/browse.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.35
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment