+
- [x]
+
+ [][]" name="[][]" value="">
+ [][]" name="_cb_[][]" checked onchange="update_checkbox(this, document.getElementById('[][]'));">
+
+
+
|
-
" id="adm[0][]">
+
">
- .gif" border="0" alt="" align="absmiddle"/>
-
+ " alt="" border="0"/>
+
+ .gif" border="0" alt="" title="" align="absmiddle"/>
+
+
+
+
+
+
+
+
+
+
+
+
+ " alt="" border="0"/>
+ []
+
|
-
-
- |
-
+
+
+
+
+
+
+
+ ', 'PermList');">
+
+
+
+ |
-
+
+
+
Index: trunk/core/units/users/users_config.php
===================================================================
diff -u -r4596 -r4607
--- trunk/core/units/users/users_config.php (.../users_config.php) (revision 4596)
+++ trunk/core/units/users/users_config.php (.../users_config.php) (revision 4607)
@@ -97,7 +97,7 @@
'icon' => 'users',
'label' => 'la_tab_User_List',
'url' => Array('index_file' => 'users/user_list.php', 'pass' => 'm', 'resetpage' => 1),
- 'permissions' => Array('view', 'edit', 'delete', 'advanced:ban', 'advanced:send_email'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email'),
'priority' => 1,
'type' => stTREE,
),
@@ -107,7 +107,7 @@
'icon' => 'users_settings',
'label' => 'la_tab_ConfigSettings',
'url' => Array('index_file' => 'config/edit_config.php', 'module' => 'In-Portal:Users', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 3,
'type' => stTREE,
),
@@ -117,7 +117,7 @@
'icon' => 'settings_email',
'label' => 'la_tab_ConfigE-mail',
'url' => Array('index_file' => 'config/module_email.php', 'module' => 'In-Portal:Users', 'lpn' => 1, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 4,
'type' => stTREE,
),
@@ -127,7 +127,7 @@
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
'url' => Array('t' => 'custom_fields/custom_fields_list', 'index_file' => 'index4.php', 'cf_type' => 6, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 5,
'type' => stTREE,
),
@@ -137,7 +137,7 @@
'icon' => 'banlist',
'label' => 'la_tab_BanList',
'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 6,
'type' => stTREE,
),
Index: trunk/core/units/general/helpers/modules.php
===================================================================
diff -u -r4592 -r4607
--- trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 4592)
+++ trunk/core/units/general/helpers/modules.php (.../modules.php) (revision 4607)
@@ -103,6 +103,55 @@
}
/**
+ * Leaves only domain part from hostname (e.g. extract "intechnic.lv" from "test.intechnic.lv")
+ * Used for admin login license check
+ *
+ * @param string $d
+ * @return string
+ */
+ function _StripDomainHost($d)
+ {
+ $dotcount = substr_count($d, '.');
+ if ($dotcount == 3) {
+ $IsIp = true;
+ for ($x = 0; $x < strlen($d); $x++) {
+ if (!is_numeric(substr($d, $x, 1)) && substr($d, $x, 1) != '.')
+ {
+ $IsIp = false;
+ break;
+ }
+ }
+ }
+
+ if ($dotcount > 1 && !$IsIp) {
+ $p = explode('.', $d);
+ $ret = $p[count($p) - 2].'.'.$p[count($p) - 1];
+ }
+ else {
+ $ret = $d;
+ }
+ return $ret;
+ }
+
+ /**
+ * When logging into admin then check only last 2 parts of host name VS domain in license
+ *
+ * @param string $user_domain
+ * @param string $license_domain
+ * @return int
+ */
+ function _CheckDomain($user_domain, $license_domain)
+ {
+ if ($this->Application->IsAdmin()) {
+ $user_domain = $this->_StripDomainHost($user_domain);
+ return preg_match('/(.*)'.preg_quote($user_domain, '/').'$/', $license_domain);
+ }
+ else {
+ return preg_match('/(.*)'.preg_quote($license_domain, '/').'$/', $user_domain);
+ }
+ }
+
+ /**
* Returns modules list, that are in license
*
* @return Array
@@ -123,7 +172,7 @@
if (!$this->_IsLocalSite($domain)) {
for ($x = 0; $x < count($i_Keys); $x++) {
$key = $i_Keys[$x];
- if (preg_match('/(.*)'.preg_quote($key['domain'], '/').'$/', $domain)) {
+ if ($this->_CheckDomain($domain, $key['domain'])) {
// used hostname is subdomain or matches domain from license
$modules = explode(',', $key['mod']);
}
Index: trunk/admin/install/inportal_schema.sql
===================================================================
diff -u -r4603 -r4607
--- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 4603)
+++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 4607)
@@ -312,7 +312,7 @@
CREATE TABLE Permissions (
PermissionId int(11) NOT NULL auto_increment,
- Permission varchar(30) NOT NULL default '',
+ Permission varchar(255) NOT NULL default '',
GroupId int(11) default '0',
PermissionValue int(11) NOT NULL default '0',
Type tinyint(4) NOT NULL default '0',
Index: trunk/kernel/units/users/users_config.php
===================================================================
diff -u -r4596 -r4607
--- trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4596)
+++ trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4607)
@@ -97,7 +97,7 @@
'icon' => 'users',
'label' => 'la_tab_User_List',
'url' => Array('index_file' => 'users/user_list.php', 'pass' => 'm', 'resetpage' => 1),
- 'permissions' => Array('view', 'edit', 'delete', 'advanced:ban', 'advanced:send_email'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email'),
'priority' => 1,
'type' => stTREE,
),
@@ -107,7 +107,7 @@
'icon' => 'users_settings',
'label' => 'la_tab_ConfigSettings',
'url' => Array('index_file' => 'config/edit_config.php', 'module' => 'In-Portal:Users', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 3,
'type' => stTREE,
),
@@ -117,7 +117,7 @@
'icon' => 'settings_email',
'label' => 'la_tab_ConfigE-mail',
'url' => Array('index_file' => 'config/module_email.php', 'module' => 'In-Portal:Users', 'lpn' => 1, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 4,
'type' => stTREE,
),
@@ -127,7 +127,7 @@
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
'url' => Array('t' => 'custom_fields/custom_fields_list', 'index_file' => 'index4.php', 'cf_type' => 6, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 5,
'type' => stTREE,
),
@@ -137,7 +137,7 @@
'icon' => 'banlist',
'label' => 'la_tab_BanList',
'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
+ 'permissions' => Array('view', 'add', 'edit'),
'priority' => 6,
'type' => stTREE,
),
Index: trunk/core/units/general/my_application.php
===================================================================
diff -u -r4590 -r4607
--- trunk/core/units/general/my_application.php (.../my_application.php) (revision 4590)
+++ trunk/core/units/general/my_application.php (.../my_application.php) (revision 4607)
@@ -26,6 +26,8 @@
$this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper');
$this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper');
$this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper');
+ $this->registerClass('kSectionsHelper', MODULES_PATH.'/kernel/units/general/helpers/sections_helper.php', 'SectionsHelper');
+ $this->registerClass('kPermissionsHelper', MODULES_PATH.'/kernel/units/general/helpers/permissions_helper.php', 'PermissionsHelper');
$this->registerClass('kModulesHelper', MODULES_PATH.'/kernel/units/general/helpers/modules.php', 'ModulesHelper');
}
Index: trunk/kernel/units/admin/admin_tag_processor.php
===================================================================
diff -u -r4603 -r4607
--- trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4603)
+++ trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4607)
@@ -2,8 +2,6 @@
class AdminTagProcessor extends kDBTagProcessor {
- var $Tree = Array();
-
function SetConst($params)
{
$name = $this->SelectParam($params, 'name,const');
@@ -157,52 +155,24 @@
*/
function BuildTree($params)
{
- $this->Tree = Array();
- $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
- $prefixes = array_keys($unit_config_reader->configData);
- foreach ($prefixes as $prefix) {
- $config =& $unit_config_reader->configData[$prefix];
- $sections = getArrayValue($config, 'Sections');
- if (!$sections) continue;
-
-// echo 'Prefix: ['.$prefix.'] has ['.count($sections).'] sections
';
-
- foreach ($sections as $section_name => $section_params) {
- // we could also skip not allowed sections here in future
- if ($section_params['type'] != stTREE) continue;
- $section_params['SectionPrefix'] = $prefix;
- $section_params['url']['m_opener'] = 'r';
- $section_params['url']['section'] = $section_name;
-
- if (!isset($section_params['url']['module'])) {
- $module = $this->Application->findModule('Path', $config['ModuleFolder'].'/');
- $section_params['url']['module'] = $module['Name'];
- }
-
- if (!isset($section_params['url']['t'])) {
- $section_params['url']['t'] = 'index';
- }
-
- $current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array();
- $this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params);
-
- $this->Tree[ $section_params['parent'] ]['children'][ "{$section_params['priority']}" ] = $section_name;
- }
-
- }
-
-// return ''.print_r($this->Tree, true).'
';
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $sections_helper->BuildTree();
}
function DrawTree($params)
{
+ static $deep_level = 0;
+
// when processings, then sort children by priority (key of children array)
$ret = '';
$section_name = $params['section_name'];
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
-
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0;
+ $params['deep_level'] = $deep_level++;
$template = $section_data['url']['t'];
unset($section_data['url']['t']);
$section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']);
@@ -215,8 +185,10 @@
foreach ($section_data['children'] as $section_name) {
$params['section_name'] = $section_name;
$ret .= $this->DrawTree($params);
+ $deep_level--;
}
+
return $ret;
}
@@ -228,7 +200,9 @@
$section_name = $this->Application->RecallVar('section');
}
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
$params['section_name'] = $section_name;
@@ -250,7 +224,9 @@
$section_name = $this->Application->RecallVar('section');
}
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
if (!isset($section_data['children'])) {
return '';
@@ -259,7 +235,7 @@
ksort($section_data['children'], SORT_NUMERIC);
foreach ($section_data['children'] as $section_name) {
$params['section_name'] = $section_name;
- $section_data =& $this->Tree[$section_name];
+ $section_data =& $sections_helper->getSectionData($section_name);
$params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0;
$template = $section_data['url']['t'];
Index: trunk/core/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r4457 -r4607
--- trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 4457)
+++ trunk/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 4607)
@@ -66,7 +66,7 @@
'icon' => 'style',
'label' => 'la_tab_Stylesheets',
'url' => Array('t' => 'stylesheets/stylesheets_list', 'index_file' => 'index4.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit', 'delete'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 3,
'type' => stTREE,
),
Index: trunk/kernel/units/general/my_application.php
===================================================================
diff -u -r4590 -r4607
--- trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 4590)
+++ trunk/kernel/units/general/my_application.php (.../my_application.php) (revision 4607)
@@ -26,6 +26,8 @@
$this->registerClass('kXMLHelper',MODULES_PATH.'/kernel/units/general/xml_helper.php','kXMLHelper');
$this->registerClass('kMultiLanguageHelper',MODULES_PATH.'/kernel/units/general/helpers/multilanguage.php','kMultiLanguageHelper');
$this->registerClass('kSearchHelper', MODULES_PATH.'/kernel/units/general/helpers/search_helper.php', 'SearchHelper');
+ $this->registerClass('kSectionsHelper', MODULES_PATH.'/kernel/units/general/helpers/sections_helper.php', 'SectionsHelper');
+ $this->registerClass('kPermissionsHelper', MODULES_PATH.'/kernel/units/general/helpers/permissions_helper.php', 'PermissionsHelper');
$this->registerClass('kModulesHelper', MODULES_PATH.'/kernel/units/general/helpers/modules.php', 'ModulesHelper');
}
Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.9.sql
===================================================================
diff -u -r4603 -r4607
--- trunk/admin/install/upgrades/inportal_upgrade_v1.1.9.sql (.../inportal_upgrade_v1.1.9.sql) (revision 4603)
+++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.9.sql (.../inportal_upgrade_v1.1.9.sql) (revision 4607)
@@ -4,4 +4,6 @@
ALTER TABLE CategoryCustomData ADD INDEX (ResourceId);
ALTER TABLE PortalUserCustomData ADD INDEX (ResourceId);
+ALTER TABLE Permissions CHANGE Permission Permission VARCHAR(255) NOT NULL;
+
UPDATE Modules SET Version = '1.1.9' WHERE Name = 'In-Portal';
\ No newline at end of file
Index: trunk/core/units/admin/admin_tag_processor.php
===================================================================
diff -u -r4603 -r4607
--- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4603)
+++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4607)
@@ -2,8 +2,6 @@
class AdminTagProcessor extends kDBTagProcessor {
- var $Tree = Array();
-
function SetConst($params)
{
$name = $this->SelectParam($params, 'name,const');
@@ -157,52 +155,24 @@
*/
function BuildTree($params)
{
- $this->Tree = Array();
- $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
- $prefixes = array_keys($unit_config_reader->configData);
- foreach ($prefixes as $prefix) {
- $config =& $unit_config_reader->configData[$prefix];
- $sections = getArrayValue($config, 'Sections');
- if (!$sections) continue;
-
-// echo 'Prefix: ['.$prefix.'] has ['.count($sections).'] sections
';
-
- foreach ($sections as $section_name => $section_params) {
- // we could also skip not allowed sections here in future
- if ($section_params['type'] != stTREE) continue;
- $section_params['SectionPrefix'] = $prefix;
- $section_params['url']['m_opener'] = 'r';
- $section_params['url']['section'] = $section_name;
-
- if (!isset($section_params['url']['module'])) {
- $module = $this->Application->findModule('Path', $config['ModuleFolder'].'/');
- $section_params['url']['module'] = $module['Name'];
- }
-
- if (!isset($section_params['url']['t'])) {
- $section_params['url']['t'] = 'index';
- }
-
- $current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array();
- $this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params);
-
- $this->Tree[ $section_params['parent'] ]['children'][ "{$section_params['priority']}" ] = $section_name;
- }
-
- }
-
-// return ''.print_r($this->Tree, true).'
';
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $sections_helper->BuildTree();
}
function DrawTree($params)
{
+ static $deep_level = 0;
+
// when processings, then sort children by priority (key of children array)
$ret = '';
$section_name = $params['section_name'];
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
-
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0;
+ $params['deep_level'] = $deep_level++;
$template = $section_data['url']['t'];
unset($section_data['url']['t']);
$section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']);
@@ -215,8 +185,10 @@
foreach ($section_data['children'] as $section_name) {
$params['section_name'] = $section_name;
$ret .= $this->DrawTree($params);
+ $deep_level--;
}
+
return $ret;
}
@@ -228,7 +200,9 @@
$section_name = $this->Application->RecallVar('section');
}
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
$params['section_name'] = $section_name;
@@ -250,7 +224,9 @@
$section_name = $this->Application->RecallVar('section');
}
- $section_data =& $this->Tree[$section_name];
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
if (!isset($section_data['children'])) {
return '';
@@ -259,7 +235,7 @@
ksort($section_data['children'], SORT_NUMERIC);
foreach ($section_data['children'] as $section_name) {
$params['section_name'] = $section_name;
- $section_data =& $this->Tree[$section_name];
+ $section_data =& $sections_helper->getSectionData($section_name);
$params['children_count'] = isset($section_data['children']) ? count($section_data['children']) : 0;
$template = $section_data['url']['t'];
Index: trunk/kernel/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r4457 -r4607
--- trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 4457)
+++ trunk/kernel/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 4607)
@@ -66,7 +66,7 @@
'icon' => 'style',
'label' => 'la_tab_Stylesheets',
'url' => Array('t' => 'stylesheets/stylesheets_list', 'index_file' => 'index4.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit', 'delete'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 3,
'type' => stTREE,
),