Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Nov 13, 2:46 PM

in-portal

Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (revision 4044)
@@ -0,0 +1,61 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'conf',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'Hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+
+ 'IDField' => 'VariableName',
+
+ 'TitlePresets' => Array(
+ 'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))),
+
+ 'config_list_general' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ 'config_list_output' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ 'config_list_contacts' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'ConfigurationValues',
+
+ 'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('DisplayOrder' => 'asc'),
+ )
+ ),
+
+ 'SubTables' => Array(),
+
+ 'Fields' => Array(
+ 'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'VariableValue' => array('type'=>'string', 'default'=>''),
+ 'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
+ 'Section' => array('type'=>'string','not_null' => '1','default'=>''),
+ ),
+
+ 'VirtualFields' => Array(
+ 'heading' => Array('type' => 'string','default' => ''),
+ 'prompt' => Array('type' => 'string','default' => ''),
+ 'element_type' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'validation' => Array('type' => 'string','default' => ''),
+ 'ValueList' => Array('type' => 'string','default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Install' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ ),
+
+ 'Grids' => Array(),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php (revision 4044)
@@ -0,0 +1,580 @@
+<?php
+
+ /**
+ * Multi database connection class
+ *
+ */
+ class kDBConnection {
+
+ /**
+ * Current database type
+ *
+ * @var string
+ * @access private
+ */
+ var $dbType = 'mysql';
+ /**
+ * Created connection handle
+ *
+ * @var resource
+ * @access private
+ */
+ var $connectionID = null;
+ /**
+ * Handle of currenty processed recordset
+ *
+ * @var resource
+ * @access private
+ */
+ var $queryID = null;
+ /**
+ * DB type specific function mappings
+ *
+ * @var Array
+ * @access private
+ */
+ var $metaFunctions = Array();
+
+ /**
+ * Function to handle sql errors
+ *
+ * @var string
+ * @access private
+ */
+ var $errorHandler = '';
+
+ /**
+ * Error code
+ *
+ * @var int
+ * @access private
+ */
+ var $errorCode = 0;
+ /**
+ * Error message
+ *
+ * @var string
+ * @access private
+ */
+ var $errorMessage = '';
+
+ /**
+ * Defines if database connection
+ * operations should generate debug
+ * information
+ *
+ * @var bool
+ */
+ var $debugMode=false;
+
+ /**
+ * Last query to database
+ *
+ * @var string
+ */
+ var $lastQuery = '';
+
+ /**
+ * Initializes connection class with
+ * db type to used in future
+ *
+ * @param string $dbType
+ * @return DBConnection
+ * @access public
+ */
+ function kDBConnection($dbType, $errorHandler = '')
+ {
+ $this->dbType = $dbType;
+ $this->initMetaFunctions();
+ if(!$errorHandler)
+ {
+ $this->errorHandler = Array(&$this,'handleError');
+ }
+ else
+ {
+ $this->errorHandler=$errorHandler;
+ }
+ }
+
+ /**
+ * Set's custom error
+ *
+ * @param int $code
+ * @param string $msg
+ * @access public
+ */
+ function setError($code,$msg)
+ {
+ $this->errorCode=$code;
+ $this->errorMessage=$msg;
+ }
+
+ /**
+ * Checks if previous query execution
+ * raised an error.
+ *
+ * @return bool
+ * @access public
+ */
+ function hasError()
+ {
+ return !($this->errorCode == 0);
+ }
+
+ /**
+ * Caches function specific to requested
+ * db type
+ *
+ * @access private
+ */
+ function initMetaFunctions()
+ {
+ $ret = Array();
+ switch($this->dbType)
+ {
+ case 'mysql':
+ $ret = Array(); // only define functions, that name differs from "dbType_<meta_name>"
+
+ break;
+
+
+ }
+ $this->metaFunctions = $ret;
+ }
+
+ /**
+ * Get's function for specific db type
+ * based on it's meta name
+ *
+ * @param string $name
+ * @return string
+ * @access private
+ */
+ function getMetaFunction($name)
+ {
+ if( !isset($this->metaFunctions[$name]) )
+ {
+ if(function_exists($this->dbType.'_'.$name)) return $this->dbType.'_'.$name;
+ }
+ else
+ {
+ return $this->dbType.$name;
+ }
+ return false;
+ }
+
+
+ /**
+ * Try to connect to database server
+ * using specified parameters and set
+ * database to $db if connection made
+ *
+ * @param string $host
+ * @param string $user
+ * @param string $pass
+ * @param string $db
+ * @access public
+ */
+ function Connect($host,$user,$pass,$db,$force_new=false)
+ {
+ $func = $this->getMetaFunction('connect');
+ $this->connectionID = $func($host,$user,$pass,$force_new) or die('Can\'t connect to db');
+ if($this->connectionID)
+ {
+ $this->setDB($db);
+ $this->showError();
+ }
+ }
+
+ function ReConnect($host,$user,$pass,$db)
+ {
+ $func = $this->getMetaFunction('close');
+ $func($this->connectionID);
+ $this->Connect($host,$user,$pass,$db);
+ }
+
+ /**
+ * Shows error message from previous operation
+ * if it failed
+ *
+ * @access private
+ */
+ function showError($sql='')
+ {
+ $this->setError(0,''); // reset error
+ if($this->connectionID)
+ {
+ $func = $this->getMetaFunction('errno'); $this->errorCode = $func($this->connectionID);
+ if($this->hasError())
+ {
+ $func = $this->getMetaFunction('error'); $this->errorMessage = $func($this->connectionID);
+ if(is_array($this->errorHandler))
+ {
+ $func = $this->errorHandler[1];
+ $ret = $this->errorHandler[0]->$func($this->errorCode,$this->errorMessage,$sql);
+ }
+ else
+ {
+ $func = $this->errorHandler;
+ $ret = $func($this->errorCode,$this->errorMessage,$sql);
+ }
+ if(!$ret) exit;
+ }
+ }
+ }
+
+ /**
+ * Default error handler for sql errors
+ *
+ * @param int $code
+ * @param string $msg
+ * @param string $sql
+ * @return bool
+ * @access private
+ */
+ function handleError($code,$msg,$sql)
+ {
+ echo '<b>Processing SQL</b>: '.$sql.'<br>';
+ echo '<b>Error ('.$code.'):</b> '.$msg.'<br>';
+ return false;
+ }
+
+ /**
+ * Set's database name for connection
+ * to $new_name
+ *
+ * @param string $new_name
+ * @return bool
+ * @access public
+ */
+ function setDB($new_name)
+ {
+ if(!$this->connectionID) return false;
+ $func = $this->getMetaFunction('select_db');
+ return $func($new_name);
+ }
+
+ /**
+ * Returns first field of first line
+ * of recordset if query ok or false
+ * otherwise
+ *
+ * @param string $sql
+ * @return string
+ * @access public
+ */
+ function GetOne($sql)
+ {
+ $row = $this->GetRow($sql);
+ if(!$row) return false;
+
+ return array_shift($row);
+ }
+
+ /**
+ * Returns first row of recordset
+ * if query ok, false otherwise
+ *
+ * @param stirng $sql
+ * @return Array
+ * @access public
+ */
+ function GetRow($sql)
+ {
+ $sql .= ' '.$this->getLimitClause(0,1);
+ $ret = $this->Query($sql);
+ if(!$ret) return false;
+
+ return array_shift($ret);
+ }
+
+ /**
+ * Returns 1st column of recordset as
+ * one-dimensional array or false otherwise
+ * Optional parameter $key_field can be used
+ * to set field name to be used as resulting
+ * array key
+ *
+ * @param string $sql
+ * @param string $key_field
+ * @return Array
+ * @access public
+ */
+ function GetCol($sql, $key_field = null)
+ {
+ $rows = $this->Query($sql);
+ if(!$rows) return $rows;
+
+ $i = 0; $row_count = count($rows);
+ $ret = Array();
+ if(isset($key_field))
+ {
+ while ($i < $row_count)
+ {
+ $ret[$rows[$i][$key_field]] = array_shift($rows[$i]);
+ $i++;
+ }
+ }
+ else
+ {
+ while ($i < $row_count)
+ {
+ $ret[] = array_shift($rows[$i]);
+ $i++;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Queries db with $sql query supplied
+ * and returns rows selected if any, false
+ * otherwise. Optional parameter $key_field
+ * allows to set one of the query fields
+ * value as key in string array.
+ *
+ * @param string $sql
+ * @param string $key_field
+ * @return Array
+ */
+ function Query($sql,$key_field = null)
+ {
+ $this->lastQuery = $sql;
+ if($this->debugMode) return $this->debugQuery($sql,$key_field);
+ $query_func = $this->getMetaFunction('query');
+ $this->queryID = $query_func($sql,$this->connectionID);
+ if( is_resource($this->queryID) )
+ {
+ $ret = Array();
+ $fetch_func = $this->getMetaFunction('fetch_assoc');
+ if( isset($key_field) )
+ {
+ while( ($row = $fetch_func($this->queryID)) )
+ {
+ $ret[$row[$key_field]] = $row;
+ }
+ }
+ else
+ {
+ while( ($row = $fetch_func($this->queryID)) )
+ {
+ $ret[] = $row;
+ }
+ }
+ $this->Destroy();
+ return $ret;
+ }
+ $this->showError($sql);
+ return false;
+ }
+
+ function ChangeQuery($sql)
+ {
+ $this->Query($sql);
+ return $this->errorCode==0 ? true : false;
+ }
+
+ function debugQuery($sql, $key_field = null)
+ {
+ global $debugger;
+ $query_func = $this->getMetaFunction('query');
+
+ // set 1st checkpoint: begin
+ $isSkipTable=true;
+ $profileSQLs=defined('DBG_SQL_PROFILE')&&DBG_SQL_PROFILE;
+ if($profileSQLs)
+ {
+ $isSkipTable=isSkipTable($sql);
+ if(!$isSkipTable)
+ {
+ $queryID=$debugger->generateID();
+ $debugger->profileStart('sql_'.$queryID, $debugger->formatSQL($sql) );
+ }
+ }
+ // set 1st checkpoint: end
+
+ $this->queryID = $query_func($sql,$this->connectionID);
+
+ // set 2nd checkpoint: begin
+ if(!$isSkipTable) {
+ $debugger->profileFinish('sql_'.$queryID);
+ $debugger->profilerAddTotal('sql', 'sql_'.$queryID);
+ }
+ // set 2nd checkpoint: end
+
+ if( is_resource($this->queryID) )
+ {
+ $ret = Array();
+ $fetch_func = $this->getMetaFunction('fetch_assoc');
+ if( isset($key_field) )
+ {
+ while( ($row = $fetch_func($this->queryID)) )
+ {
+ $ret[$row[$key_field]] = $row;
+ }
+ }
+ else
+ {
+ while( ($row = $fetch_func($this->queryID)) )
+ {
+ $ret[] = $row;
+ }
+ }
+ $this->Destroy();
+ return $ret;
+ }
+ $this->showError($sql);
+ return false;
+ }
+
+ /**
+ * Free memory used to hold recordset handle
+ *
+ * @access private
+ */
+ function Destroy()
+ {
+ if($this->queryID)
+ {
+ $free_func = $this->getMetaFunction('free_result');
+ $free_func($this->queryID);
+ $this->queryID = null;
+ }
+ }
+
+ /**
+ * Returns auto increment field value from
+ * insert like operation if any, zero otherwise
+ *
+ * @return int
+ * @access public
+ */
+ function getInsertID()
+ {
+ $func = $this->getMetaFunction('insert_id');
+ return $func($this->connectionID);
+ }
+
+ /**
+ * Returns row count affected by last query
+ *
+ * @return int
+ * @access public
+ */
+ function getAffectedRows()
+ {
+ $func = $this->getMetaFunction('affected_rows');
+ return $func($this->connectionID);
+ }
+
+ /**
+ * Returns LIMIT sql clause part for specific db
+ *
+ * @param int $offset
+ * @param int $rows
+ * @return string
+ * @access private
+ */
+ function getLimitClause($offset, $rows)
+ {
+ if(!($rows > 0)) return '';
+
+ switch ($this->dbType) {
+
+ default:
+ return 'LIMIT '.$offset.','.$rows;
+ break;
+ }
+ }
+
+ /**
+ * Correctly quotes a string so that all strings are escaped. We prefix and append
+ * to the string single-quotes.
+ * An example is $db->qstr("Don't bother",magic_quotes_runtime());
+ *
+ * @param s the string to quote
+ * @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
+ * This undoes the stupidity of magic quotes for GPC.
+ *
+ * @return quoted string to be sent back to database
+ */
+ function qstr($s,$magic_quotes=false)
+ {
+ $replaceQuote = "\\'";
+ if (!$magic_quotes)
+ {
+ if ($replaceQuote[0] == '\\')
+ {
+ // only since php 4.0.5
+ $s = str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
+ //$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s));
+ }
+ return "'".str_replace("'",$replaceQuote,$s)."'";
+ }
+
+ // undo magic quotes for "
+ $s = str_replace('\\"','"',$s);
+
+ if($replaceQuote == "\\'") // ' already quoted, no need to change anything
+ {
+ return "'$s'";
+ }
+ else // change \' to '' for sybase/mssql
+ {
+ $s = str_replace('\\\\','\\',$s);
+ return "'".str_replace("\\'",$replaceQuote,$s)."'";
+ }
+ }
+
+ /**
+ * Returns last error code occured
+ *
+ * @return int
+ */
+ function getErrorCode()
+ {
+ return $this->errorCode;
+ }
+
+ /**
+ * Returns last error message
+ *
+ * @return string
+ * @access public
+ */
+ function getErrorMsg()
+ {
+ return $this->errorMessage;
+ }
+
+ function doInsert($fields_hash, $table, $type = 'INSERT')
+ {
+ $fields_sql = '';
+ $values_sql = '';
+ foreach ($fields_hash as $field_name => $field_value) {
+ $fields_sql .= '`'.$field_name.'`,';
+ $values_sql .= $this->qstr($field_value).',';
+ }
+
+ $fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql);
+ $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql);
+ $sql = strtoupper($type).' INTO `'.$table.'` ('.$fields_sql.') VALUES ('.$values_sql.')';
+
+ return $this->ChangeQuery($sql);
+ }
+
+ function doUpdate($fields_hash, $table, $key_clause)
+ {
+ $fields_sql = '';
+ foreach ($fields_hash as $field_name => $field_value) {
+ $fields_sql .= '`'.$field_name.'` = '.$this->qstr($field_value).',';
+ }
+
+ $fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql);
+
+ $sql = 'UPDATE `'.$table.'` SET '.$fields_sql.' WHERE '.$key_clause;
+
+ return $this->ChangeQuery($sql);
+ }
+ }
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (revision 4044)
@@ -0,0 +1,61 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'conf',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'Hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+
+ 'IDField' => 'VariableName',
+
+ 'TitlePresets' => Array(
+ 'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))),
+
+ 'config_list_general' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ 'config_list_output' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ 'config_list_contacts' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'ConfigurationValues',
+
+ 'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('DisplayOrder' => 'asc'),
+ )
+ ),
+
+ 'SubTables' => Array(),
+
+ 'Fields' => Array(
+ 'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'VariableValue' => array('type'=>'string', 'default'=>''),
+ 'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
+ 'Section' => array('type'=>'string','not_null' => '1','default'=>''),
+ ),
+
+ 'VirtualFields' => Array(
+ 'heading' => Array('type' => 'string','default' => ''),
+ 'prompt' => Array('type' => 'string','default' => ''),
+ 'element_type' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'validation' => Array('type' => 'string','default' => ''),
+ 'ValueList' => Array('type' => 'string','default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'Install' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ ),
+
+ 'Grids' => Array(),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/admin/category/addpermission.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/admin/category/addpermission.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.8.2/admin/category/addpermission.php (revision 4044)
@@ -0,0 +1,339 @@
+<?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/category');
+$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
+
+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");
+require_once($pathtoroot.$admin."/listview/listview.php");
+
+$m = GetModuleArray();
+foreach($m as $key=>$value)
+{
+ $path = $pathtoroot. $value."admin/include/parser.php";
+ if(file_exists($path))
+ {
+ include_once($path);
+ }
+}
+
+unset($objEditItems);
+
+$objEditItems = new clsCatList();
+$objEditItems->SourceTable = $objSession->GetEditTable("Category");
+
+//Multiedit init
+$en = (int)$_GET["en"];
+$objEditItems->Query_Item("SELECT * FROM ".$objEditItems->SourceTable);
+$itemcount=$objEditItems->NumItems();
+
+$c = $objEditItems->GetItemByIndex($en);
+
+if(!is_object($c))
+{
+ $c = new clsCategory();
+ $c->Set("CategoryId",0);
+}
+if($itemcount>1)
+{
+ if ($en+1 == $itemcount)
+ $en_next = -1;
+ else
+ $en_next = $en+1;
+
+ if ($en == 0)
+ $en_prev = -1;
+ else
+ $en_prev = $en-1;
+}
+$action = "m_edit_permissions";
+
+$envar = "env=" . BuildEnv() . "&en=$en";
+
+$section = 'in-portal:catperm_setperm';
+$Module = $_GET["module"];
+$GroupId = $_GET["GroupId"];
+
+$g = $objGroups->GetItem($GroupId);
+
+$objPermList = new clsPermList($c->Get("CategoryId"),$GroupId);
+$objPermList->LoadPermTree($c);
+
+$objParentPerms = new clsPermList($c->Get("ParentId"),$GroupId);
+$p = $objCatList->GetCategory($c->Get("ParentId"));
+$objParentPerms->LoadPermTree($p);
+
+$ado = &GetADODBConnection();
+
+/* page header */
+$charset = GetRegionalOption('Charset');
+print <<<END
+<html>
+<head>
+ <title>In-portal</title>
+ <meta http-equiv="content-type" content="text/html;charset=$charset">
+ <meta http-equiv="Pragma" content="no-cache">
+ <script language="JavaScript">
+ imagesPath='$imagesURL'+'/';
+ </script>
+ <script src="$browseURL/common.js"></script>
+ <script src="$browseURL/toolbar.js"></script>
+ <script src="$browseURL/utility.js"></script>
+ <script src="$browseURL/checkboxes.js"></script>
+ <script language="JavaScript1.2" src="$browseURL/fw_menu.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;
+
+//int_SectionHeader();
+//$back_url = $rootURL."admin/category/addpermission_modules.php?env=".BuildEnv()."&GroupId=$GroupId";
+$back_url = "javascript:do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);";
+
+if($c->Get("CategoryId")>0)
+{
+ $title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Category")." '".$c->Get("Name")."' - ".prompt_language("la_tab_Permissions");
+ $title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'";
+}
+else
+{
+ $title = prompt_language("la_Text_Editing")." ".prompt_language("la_Text_Root")." ".prompt_language("la_Text_Category")." - "."' - ".prompt_language("la_tab_Permissions");
+ $title .= " ".prompt_language("la_text_for")." '".$g->parsetag("group_name")."'";
+}
+
+$objListToolBar = new clsToolBar();
+
+$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);",$imagesURL."/toolbar/tool_select.gif");
+//$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('category','admin/category/addpermission_modules.php',-1);", $imagesURL."/toolbar/tool_cancel.gif");
+$objListToolBar->Add("img_cancel", "la_Cancel",$back_url,"swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","", $imagesURL."/toolbar/tool_cancel.gif");
+$sec = $objSections->GetSection($section);
+
+if($c->Get("CategoryId")==0)
+{
+ $sec->Set("left",NULL);
+ $sec->Set("right",NULL);
+
+}
+int_header($objListToolBar,NULL,$title);
+if ($objSession->GetVariable("HasChanges") == 1) {
+?>
+<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
+ <tr>
+ <td valign="top">
+ <?php int_hint_red(admin_language("la_Warning_Save_Item")); ?>
+ </td>
+ </tr>
+</table>
+<?php } ?>
+<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
+<TBODY>
+ <tr BGCOLOR="#e0e0da">
+ <td WIDTH="100%" CLASS="navar">
+ <img height="15" src="<?php echo $imagesURL; ?>/arrow.gif" width="15" align="middle" border="0">
+ <span class="navbar"><A CLASS="control_link" HREF="<?php echo $back_url; ?>">
+ <?php echo prompt_language("la_Prompt_CategoryPermissions")."</A>&gt;"; ?></span>
+ <SPAN CLASS="NAV_CURRENT_ITEM"><?php echo $Module; ?></SPAN>
+ </td>
+ </TR>
+</TBODY>
+</TABLE>
+<TABLE CELLPADDING=0 CELLSPACING=0 class="tableborder" width="100%">
+
+<FORM ID="category" NAME="category" method="POST" ACTION="">
+<TBODY>
+ <TR class="subsectiontitle">
+ <?php
+ echo "<TD>".prompt_language("la_prompt_Description")."</TD>";
+ if($c->Get("CategoryId")!=0)
+ {
+ echo "<TD>".prompt_language("la_ColHeader_PermInherited")."</TD>";
+ }
+ echo "<TD>".prompt_language("la_ColHeader_PermAccess")."</TD>\n";
+ if($c->Get("CategoryId")!=0)
+ {
+ echo "<td>".prompt_language("la_ColHeader_InheritFrom")."</TD>";
+ }
+ ?>
+ </TR>
+<?php
+ if($c->Get("CategoryId")>0)
+ {
+ $ParentCatList = "0".$c->Get("ParentPath");
+ }
+ else
+ $ParentCatList = "0".$c->GetParentField("ParentPath","","");
+ $ParentCats = explode("|",$ParentCatList);
+ $ParentCats = array_reverse($ParentCats);
+
+ $sql = "SELECT * FROM ".GetTablePrefix()."PermissionConfig WHERE ModuleId='$Module'";
+ $rs = $ado->Execute($sql);
+ while($rs && !$rs->EOF)
+ {
+ $perm = $rs->fields;
+ $Permission = $perm["PermissionName"];
+ $Desc = $perm["Description"];
+ echo "<TR ".int_table_color_ret().">\n";
+ echo "<TD>".prompt_language("$Desc")." [$Permission]</TD>";
+ $p = $objPermList->GetPermByName($Permission);
+ $checked = "";
+ $MatchCatPath = "";
+ if(is_object($p))
+ {
+ //echo $p->Get("Permission")." Found<br>\n";
+ if($p->Inherited)
+ {
+ $checked = " CHECKED";
+ $MatchCatPath = "";
+ if($c->Get("CategoryId")>0)
+ {
+ $MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId);
+ }
+ else
+ $MatchedCat = $objParentPerms->GetDefinedCategory($Permission,$GroupId);
+
+ if(is_numeric($MatchedCat))
+ {
+ if($MatchedCat!=0)
+ {
+ $mcat = $objCatList->GetCategory($MatchedCat);
+ $MatchCatPath = language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar");
+ }
+ else
+ $MatchCatPath = language($objConfig->Get("Root_Name"));
+ }
+ else
+ $MatchCatPath = "";
+ }
+ }
+ else
+ $checked = " CHECKED";
+ if($c->Get("CategoryId")!=0)
+ {
+ echo " <TD><INPUT access=\"chk".$Permission."\" ONCLICK=\"SetAccessEnabled(this); \" TYPE=CHECKBOX name=\"inherit[]\" VALUE=\"".$Permission."\" $checked></TD>\n";
+ }
+ else
+ {
+ if(is_object($p))
+ $p->Inherited = FALSE;
+ }
+ $checked = "";
+ $imgsrc="red";
+ if(is_object($p))
+ {
+ if($p->Get("PermissionValue"))
+ {
+ $checked = " CHECKED";
+ $imgsrc = "green";
+ $current = "true";
+ }
+ else
+ {
+ $imgsrc = "red";
+ $current = "false";
+ }
+ $disabled = "";
+ if($p->Inherited)
+ {
+ if($c->Get("CategoryId")!=0)
+ {
+ $InheritValue = $current;
+ $UnInheritValue = "false";
+ $disabled = "DISABLED=\"true\"";
+ }
+ else
+ {
+ $disabled = "";
+ $UnInheritValue = "false";
+ $InheritValue="false";
+
+ }
+ }
+ else
+ {
+ $disabled = "";
+ if($p->Get("PermissionValue"))
+ {
+ $InheritValue = "false"; //need to look this up!
+ }
+ else
+ $InheritValue = "false";
+ $UnInheritValue = $current;
+ }
+
+ }
+ else
+ {
+ if($c->Get("CategoryId")!=0)
+ {
+ $disabled = "DISABLED=\"true\"";
+ $InheritValue = "false";
+ $UnInheritValue = "false";
+ $Matched = FALSE;
+ $MatchCatPath = "";
+ $MatchedCat = $objPermList->GetDefinedCategory($Permission,$GroupId);
+ if(is_numeric($MatchedCat))
+ {
+ if($MatchedCat>0)
+ {
+ $mcat = $objCatList->GetCategory($MatchedCat);
+ $MatchCatPath =language($objConfig->Get("Root_Name")).">".$mcat->Get("CachedNavbar");
+ }
+ else
+ $MatchCatPath = language($objConfig->Get("Root_Name"));
+ }
+ else
+ $MatchCatPath = "";
+ }
+ else
+ {
+ $disabled = "";
+ $UnInheritValue = "false";
+ $InheritValue="false";
+ }
+ }
+ echo " <TD><INPUT $disabled InheritValue=\"$InheritValue\" UnInheritValue=\"$UnInheritValue\" ID=\"chk".$Permission."\" ONCLICK=\"SetPermImage(this); \" permimg=\"img".$Permission."\" TYPE=CHECKBOX name=\"permvalue[]\" VALUE=\"".$Permission."\" $checked>";
+
+ echo " <img ID=\"img".$Permission."\" SRC=\"$imagesURL/perm_".$imgsrc.".gif\">";
+ echo " </TD>\n";
+ if($c->Get("CategoryId")!=0)
+ echo "<TD>$MatchCatPath</TD>";
+ echo "</TR>\n";
+ $rs->MoveNext();
+ }
+?>
+</TBODY>
+ <INPUT TYPE="HIDDEN" NAME="Action" VALUE="m_edit_permissions">
+ <input type="hidden" NAME="GroupId" VALUE="<?php echo $GroupId; ?>">
+ <input TYPE="HIDDEN" NAME="CategoryId" VALUE="<?php echo $c->Get("CategoryId"); ?>">
+ <input type="hidden" name="CatEditStatus" VALUE="0">
+ <input TYPE="HIDDEN" NAME="Module" VALUE="<?php echo $Module; ?>">
+</FORM>
+</TABLE>
+<!-- CODE FOR VIEW MENU -->
+<form method="post" action="user_groups.php?<?php echo $envar; ?>" 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>
+<!-- END CODE-->
+<?php int_footer(); ?>
Property changes on: branches/unlabeled/unlabeled-1.8.2/admin/category/addpermission.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.8
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline