Index: trunk/kernel/include/config.php =================================================================== diff -u -N -r5248 -r5289 --- trunk/kernel/include/config.php (.../config.php) (revision 5248) +++ trunk/kernel/include/config.php (.../config.php) (revision 5289) @@ -233,7 +233,7 @@ { if(strlen($s)) $s .= ","; - $s .= $rs->fields["OptionName"]."="."+".$rs->fields["OptionValue"]; + $s .= $rs->fields["OptionValue"]."="."+".$rs->fields["OptionName"]; } $rs->MoveNext(); } Index: trunk/admin/tools/sql_result.php =================================================================== diff -u -N -r2853 -r5289 --- trunk/admin/tools/sql_result.php (.../sql_result.php) (revision 2853) +++ trunk/admin/tools/sql_result.php (.../sql_result.php) (revision 5289) @@ -65,8 +65,7 @@ 0) - { + if ($SqlErrorNum > 0) { ?> > @@ -76,42 +75,48 @@ classname = "clsItemDB"; - echo ""; - while($SqlResult && !$SqlResult->EOF) - { - $ResultObject->AddItemFromArray($SqlResult->fields,TRUE); - $SqlResult->MoveNext(); + } + else { + $ResultObject = new clsItemCollection(); + $ResultObject->classname = "clsItemDB"; + echo ''; } - $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 "
'; + while ($SqlResult && !$SqlResult->EOF) { + $ResultObject->AddItemFromArray($SqlResult->fields,TRUE); + $SqlResult->MoveNext(); + } + + if (method_exists($SqlResult, 'FieldTypesArray')) { + // it was query that has results + $objListView = new clsListView(NULL,$ResultObject); + + echo ''; + $fields = $SqlResult->FieldTypesArray(); + if ($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 '
'; + } + else { + echo language('no_results'); + } + echo '
"; - } ?> \ No newline at end of file Index: trunk/admin/install/upgrades/inportal_upgrade_v1.2.0.sql =================================================================== diff -u -N -r5111 -r5289 --- trunk/admin/install/upgrades/inportal_upgrade_v1.2.0.sql (.../inportal_upgrade_v1.2.0.sql) (revision 5111) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.2.0.sql (.../inportal_upgrade_v1.2.0.sql) (revision 5289) @@ -14,7 +14,7 @@ ALTER TABLE PhraseCache ADD ConfigVariables text; -UPDATE ConfigurationAdmin SET ValueList = '0=lu_none,SELECT GroupId AS OptionName, Name AS OptionValue FROM PortalGroup WHERE Enabled = 1 AND Personal = 0' WHERE VariableName IN ('User_NewGroup','User_GuestGroup','User_SubscriberGroup','User_LoggedInGroup'); +UPDATE ConfigurationAdmin SET ValueList = '0=lu_none,SELECT GroupId AS OptionValue, Name AS OptionName FROM PortalGroup WHERE Enabled = 1 AND Personal = 0' WHERE VariableName IN ('User_NewGroup','User_GuestGroup','User_SubscriberGroup','User_LoggedInGroup'); UPDATE ConfigurationAdmin SET heading = 'la_Text_General' WHERE VariableName = 'Category_Sortorder2'; INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-portal:root.view', 11, 1, 1, 0); @@ -103,4 +103,6 @@ INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-portal:server_info.view', 11, 1, 1, 0); INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-portal:help.view', 11, 1, 1, 0); +UPDATE ConfigurationAdmin SET ValueList = 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 1) AND (IsSystem = 0)' WHERE VariableName IN ('Category_Sortfield', 'Category_Sortfield2'); + UPDATE Modules SET Version = '1.2.0' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/kernel/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r4612 -r5289 --- trunk/kernel/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 4612) +++ trunk/kernel/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5289) @@ -1,9 +1,7 @@ Application->GetVar('group_id'); + $module = $this->Application->GetVar('module'); + } + } ?> \ No newline at end of file Index: trunk/core/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r4612 -r5289 --- trunk/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 4612) +++ trunk/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5289) @@ -1,9 +1,7 @@ Application->GetVar('group_id'); + $module = $this->Application->GetVar('module'); + } + } ?> \ No newline at end of file Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r5210 -r5289 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 5210) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 5289) @@ -352,6 +352,7 @@ TWFyZ2luIFRvcA== TWVzc2FnZSBCb2R5 TWVzc2FnZSBUeXBl + TW9kaWZpZWQ= TW9kdWxl TmFtZQ== TmV3 Index: trunk/admin/tools/sql_query.php =================================================================== diff -u -N -r2853 -r5289 --- trunk/admin/tools/sql_query.php (.../sql_query.php) (revision 2853) +++ trunk/admin/tools/sql_query.php (.../sql_query.php) (revision 5289) @@ -48,8 +48,6 @@ $cancelUrl = $admin."/subitems.php?section=in-portal:tools&".$envar; -$action = "m_sql_query"; - $sql_query = trim($objSession->GetVariable("LastSQLquery")); $objCatToolBar = new clsToolBar(); @@ -73,7 +71,7 @@   - + \ No newline at end of file Index: trunk/admin/install/upgrades/changelog_1_2_0.txt =================================================================== diff -u -N -r4971 -r5289 --- trunk/admin/install/upgrades/changelog_1_2_0.txt (.../changelog_1_2_0.txt) (revision 4971) +++ trunk/admin/install/upgrades/changelog_1_2_0.txt (.../changelog_1_2_0.txt) (revision 5289) @@ -47,8 +47,11 @@ File in-portal/admin/install/install_lib.php changed File in-portal/admin/install/prerequisit_errors.php changed File in-portal/admin/install/langpacks/english.lang changed -File in-portal/admin/install/upgrades/inportal_upgrade_v1.2.0.sql is new; release_1_2_0 revision 1.3 +File in-portal/admin/install/upgrades/changelog_1_2_0.txt is new; release_1_2_0 revision 1.1.2.1 +File in-portal/admin/install/upgrades/inportal_upgrade_v1.2.0.sql is new; release_1_2_0 revision 1.3.2.3 File in-portal/admin/install/upgrades/readme_1_1_9.txt is new; release_1_2_0 revision 1.1 +File in-portal/admin/tools/sql_query.php changed +File in-portal/admin/tools/sql_result.php changed File in-portal/admin/tree/ftiens4.js is removed; release_1_1_8 revision 1.2 File in-portal/admin/tree/ftv2blank.gif is removed; release_1_1_8 revision 1.1 File in-portal/admin/tree/ftv2doc.gif is removed; release_1_1_8 revision 1.1 @@ -96,7 +99,7 @@ File in-portal/kernel/admin_templates/index.tpl changed File in-portal/kernel/admin_templates/login.tpl is new; release_1_2_0 revision 1.3 File in-portal/kernel/admin_templates/no_permission.tpl is new; release_1_2_0 revision 1.5 -File in-portal/kernel/admin_templates/sections_list.tpl is new; release_1_2_0 revision 1.8 +File in-portal/kernel/admin_templates/sections_list.tpl is new; release_1_2_0 revision 1.8.2.1 File in-portal/kernel/admin_templates/tree.tpl is new; release_1_2_0 revision 1.14 File in-portal/kernel/admin_templates/user_selector.tpl is new; release_1_2_0 revision 1.4 File in-portal/kernel/admin_templates/category/category_items.tpl is new; release_1_2_0 revision 1.2 @@ -219,8 +222,10 @@ File in-portal/kernel/admin_templates/stylesheets/stylesheets_list.tpl changed File in-portal/kernel/admin_templates/summary/root.tpl is new; release_1_2_0 revision 1.2 File in-portal/kernel/admin_templates/visits/visits_list.tpl changed -File in-portal/kernel/admin_templates/xml/tree_categories.tpl is new; release_1_2_0 revision 1.2 +File in-portal/kernel/admin_templates/xml/tree_categories.tpl is new; release_1_2_0 revision 1.2.2.1 File in-portal/kernel/cache/.cvsignore changed +File in-portal/kernel/images/.cvsignore changed +File in-portal/kernel/images/pending/.cvsignore changed File in-portal/kernel/include/config.php changed File in-portal/kernel/include/customfield.php changed File in-portal/kernel/include/custommetadata.php changed @@ -267,6 +272,7 @@ File in-portal/kernel/units/email_events/email_events_event_handler.php changed File in-portal/kernel/units/general/cat_dbitem.php changed File in-portal/kernel/units/general/cat_event_handler.php changed +File in-portal/kernel/units/general/custom_fields.php changed File in-portal/kernel/units/general/general_config.php changed File in-portal/kernel/units/general/inp1_parser.php changed File in-portal/kernel/units/general/inp_db_event_handler.php changed @@ -276,10 +282,12 @@ File in-portal/kernel/units/general/xml_helper.php changed File in-portal/kernel/units/general/helpers/mod_rewrite_helper.php is new; release_1_2_0 revision 1.2 File in-portal/kernel/units/general/helpers/modules.php is new; release_1_2_0 revision 1.5 -File in-portal/kernel/units/general/helpers/permissions_helper.php is new; release_1_2_0 revision 1.8 +File in-portal/kernel/units/general/helpers/multilanguage.php changed +File in-portal/kernel/units/general/helpers/permissions_helper.php is new; release_1_2_0 revision 1.8.2.2 File in-portal/kernel/units/general/helpers/sections_helper.php is new; release_1_2_0 revision 1.6 -File in-portal/kernel/units/groups/groups_config.php is new; release_1_2_0 revision 1.8 +File in-portal/kernel/units/groups/groups_config.php is new; release_1_2_0 revision 1.8.2.1 File in-portal/kernel/units/groups/groups_event_handler.php is new; release_1_2_0 revision 1.1 +File in-portal/kernel/units/groups/groups_item.php is new; release_1_2_0 revision 1.1.2.1 File in-portal/kernel/units/help/help_tag_processor.php changed File in-portal/kernel/units/images/image_event_handler.php is new; release_1_2_0 revision 1.1 File in-portal/kernel/units/images/image_tag_processor.php is new; release_1_2_0 revision 1.1 @@ -341,6 +349,7 @@ File kernel4_dev/kernel4/utility/adodb-time.inc.php changed File kernel4_dev/kernel4/utility/cache.php changed File kernel4_dev/kernel4/utility/debugger.php changed +File kernel4_dev/kernel4/utility/email.php changed File kernel4_dev/kernel4/utility/event.php changed File kernel4_dev/kernel4/utility/factory.php changed File kernel4_dev/kernel4/utility/formatters.php is removed; release_1_1_8 revision 1.32 Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r5258 -r5289 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 5258) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 5289) @@ -726,11 +726,11 @@ // check by permissions: begin if ((isset($params['perm_event']) && $params['perm_event']) || (isset($params['permissions']) && $params['permissions'])) { - $perm_helper =& $this->Application->recallObject('PermissionsHelper'); - $perm_status = $perm_helper->TagPermissionCheck($params, 'm_RequireLogin'); - if (!$perm_status) { - list($redirect_template, $redirect_params) = $perm_helper->getPermissionTemplate($params); - $this->Application->Redirect($redirect_template, $redirect_params); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + $perm_status = $perm_helper->TagPermissionCheck($params, 'm_RequireLogin'); + if (!$perm_status) { + list($redirect_template, $redirect_params) = $perm_helper->getPermissionTemplate($params); + $this->Application->Redirect($redirect_template, $redirect_params); } else { return ; Index: trunk/kernel/action.php =================================================================== diff -u -N -r5254 -r5289 --- trunk/kernel/action.php (.../action.php) (revision 5254) +++ trunk/kernel/action.php (.../action.php) (revision 5289) @@ -1742,15 +1742,14 @@ break; case "m_sql_query": - if($ro_perm) break; - $SqlQuery = $_POST["sql"]; - $ado = &GetADODBConnection(); - if(strlen($sql)) - { - $SqlResult = $ado->Execute(stripslashes($SqlQuery)); - $SqlError = $ado->ErrorMsg(); - $SqlErrorNum = $ado->ErrorNo(); - } + if($ro_perm) break; + $sql_query = $application->GetVar('sql'); + $ado =& GetADODBConnection(); + if ($sql_query) { + $SqlResult = $ado->Execute($sql_query); + $SqlError = $ado->ErrorMsg(); + $SqlErrorNum = $ado->ErrorNo(); + } break; case 'm_purge_email_log': Index: trunk/kernel/units/general/custom_fields.php =================================================================== diff -u -N -r5110 -r5289 --- trunk/kernel/units/general/custom_fields.php (.../custom_fields.php) (revision 5110) +++ trunk/kernel/units/general/custom_fields.php (.../custom_fields.php) (revision 5289) @@ -6,14 +6,13 @@ * @todo rewrite */ class InpCustomFieldsHelper extends kHelper { - + function GetValuesHash($values_list) { - $optionValuesStr = $this->ParseConfigSQL($values_list); - $optionValuesTmp = explode(',', trim($optionValuesStr, ',')); + $optionValuesStr = trim($this->ParseConfigSQL($values_list), ','); + $optionValuesTmp = explode(',', $optionValuesStr); $optionValues = Array(); - foreach($optionValuesTmp as $optionValue) - { + foreach ($optionValuesTmp as $optionValue) { list($key, $val) = explode('=', $optionValue); $val = (substr($val,0,1) == '+') ? substr($val, 1) : $this->Application->Phrase($val); $optionValues[$key] = $val; @@ -26,75 +25,49 @@ * * @param string $valueString * @return string - * @todo Fully rewrite !!! + * @todo Apply refactoring to embedded vars stuff */ function ParseConfigSQL($valueString) { $string = trim( str_replace('', TABLE_PREFIX, $valueString) ); preg_match_all("|\{(.*)\}|U", $string, $embedded_vars, PREG_SET_ORDER); - + /* in ValueList now can use globally available variables. Usage: {$_POST['variable']|what to output if $_POST['variable'] is set} e.g. $_POST['variable']='Hello' Will output: what to output if Hello is set */ - - if($embedded_vars) - { - for($i = 0; $i < count($embedded_vars); $i++) - { + + if ($embedded_vars) { + for ($i = 0; $i < count($embedded_vars); $i++) { $embedded_var = $embedded_vars[$i][1]; $embedded_var_src = $embedded_vars[$i][0]; - + list($var_name, $pattern) = explode('|', $embedded_var); eval('$var_value = (isset('.$var_name.')?'.$var_name.':false);'); - - if ($var_value !== false) - { + + if ($var_value !== false) { $pattern = str_replace($var_name, $var_value, $pattern); $string = str_replace($embedded_var_src, $pattern, $string); } - else - { + else { $string = str_replace($embedded_var_src, '', $string); } } - } - - $start = strpos($string,''); - if(!$end) - { - $end = strlen($string); + } + + if (preg_match_all('/(.*?)<\/SQL>/', $string, $regs)) { + $i = 0; + $sql_count = count($regs[0]); + while ($i < $sql_count) { + $string = str_replace(''.$regs[2][$i].'', $this->QueryConfigSQL($regs[2][$i], $regs[1][$i]), $string); + $i++; } - $len = $end - $start; - $sql = substr($string,$start+$skip_length,$len-$skip_length); - - $sql_val = $this->QueryConfigSQL($sql, $plus); - - /*if ($start>0 && $sql_val!='') - $sql_val=",".$sql_val;*/ - if ($end < strlen($string)-$skip_length-1 && $sql_val!='') - $sql_val.=","; - - $chunk1=substr($string,0,$start); - $chunk2=substr($string,$end+$skip_length+1); - $s = $chunk1.$sql_val.$chunk2; - - $string = $s; - - $start = strpos($string, 'Conn->Query($sql); for($i=0; $i \ No newline at end of file Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -N -r5231 -r5289 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 5231) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 5289) @@ -2,17 +2,17 @@ INSERT INTO ConfigurationAdmin VALUES ('Site_Path', 'la_Text_Website', 'la_config_web_address', 'text', '', '', 10.01, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Backup_Path', 'la_Text_BackupPath', 'la_config_backup_path', 'text', '', '', 40.01, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Domain_Detect', 'la_Text_Website', 'la_config_detect_domain', 'text', '', '', 8, 0, 1); -INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield', 'la_Text_General', 'la_category_sortfield_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,Pop=la_Category_Pop,SELECT FieldLabel as OptionName, FieldName as OptionValue FROM CustomField WHERE Type=0', 10.01, 1, 1); +INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield', 'la_Text_General', 'la_category_sortfield_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 1) AND (IsSystem = 0)', 10.01, 1, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_Sortorder', 'la_Text_General', 'la_category_sortfield_prompt', 'select', '', 'asc=la_common_ascending,desc=la_common_descending', 10.01, 2, 1); -INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield2', 'la_Text_General', 'la_category_sortfield2_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,Pop=la_Category_Pop,SELECT FieldLabel as OptionName, FieldName as OptionValue FROM CustomField WHERE Type=0', 10.02, 1, 1); +INSERT INTO ConfigurationAdmin VALUES ('Category_Sortfield2', 'la_Text_General', 'la_category_sortfield2_prompt', 'select', '', 'Name=la_Category_Name,Description=la_Category_Description,CreatedOn=la_Category_Date,EditorsPick=la_Category_Pick,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 1) AND (IsSystem = 0)', 10.02, 1, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_Sortorder2', 'la_Text_General', 'la_category_sortfield2_prompt', 'select', '', 'asc=la_common_ascending,desc=la_common_descending', 10.02, 2, 1); INSERT INTO ConfigurationAdmin VALUES ('Perpage_Category', 'la_Text_General', 'la_category_perpage_prompt', 'text', '', '', 10.03, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_DaysNew', 'la_Text_General', 'la_category_daysnew_prompt', 'text', '', '', 10.05, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_ShowPick', 'la_Text_General', 'la_category_showpick_prompt', 'checkbox', '', '', 10.06, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_MetaKey', 'la_Text_MetaInfo', 'la_category_metakey', 'text', '', '', 20.01, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Category_MetaDesc', 'la_Text_MetaInfo', 'la_category_metadesc', 'text', '', '', 20.02, 0, 1); -INSERT INTO ConfigurationAdmin VALUES ('User_NewGroup', 'la_Text_General', 'la_users_new_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.08, 0, 1); -INSERT INTO ConfigurationAdmin VALUES ('User_GuestGroup', 'la_Text_General', 'la_users_guest_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.1, 0, 1); +INSERT INTO ConfigurationAdmin VALUES ('User_NewGroup', 'la_Text_General', 'la_users_new_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.08, 0, 1); +INSERT INTO ConfigurationAdmin VALUES ('User_GuestGroup', 'la_Text_General', 'la_users_guest_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.1, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('RootPass', 'la_Text_General', 'la_prompt_root_pass', 'password', NULL, NULL, 10.12, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('RootPassVerify', 'la_Text_General', 'la_prompt_root_pass_verify', 'password', NULL, NULL, 10.13, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Users_AllowReset', 'la_Text_General', 'la_prompt_allow_reset', 'text', NULL, NULL, 10.05, 0, 0); @@ -41,13 +41,13 @@ INSERT INTO ConfigurationAdmin VALUES ('SessionTimeout', 'la_Text_Website', 'la_prompt_session_timeout', 'text', '', '', 10.05, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('SystemTagCache', 'la_Text_Website', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 10.07, 0, 0); -INSERT INTO ConfigurationAdmin VALUES ('User_SubscriberGroup', 'la_Text_General', 'la_users_subscriber_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.11, 0, 1); +INSERT INTO ConfigurationAdmin VALUES ('User_SubscriberGroup', 'la_Text_General', 'la_users_subscriber_group', 'select', NULL, '0=lu_none,SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.11, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Root_Name', 'la_Text_General', 'la_prompt_root_name', 'text', '', '', 10.07, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('SocketBlockingMode', 'la_Text_Website', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 10.08, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_UserName', 'la_Text_General', 'la_text_min_username', 'text', '', '', 10.03, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_Password', 'la_Text_General', 'la_text_min_password', 'text', '', '', 10.04, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Email_As_Login', 'la_Text_General', 'la_use_emails_as_login', 'checkbox', NULL, NULL, 10.02, 0, 0); -INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_assign_all_to', 'select', NULL, '0=lu_none,SELECT GroupId as OptionName, Name as OptionValue FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.09, 0, 1); +INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_assign_all_to', 'select', NULL, '0=lu_none,SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.09, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('FirstDayOfWeek', 'la_Text_Date_Time_Settings', 'la_config_first_day_of_week', 'select', '', '0=la_sunday,1=la_monday', 20.03, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('SSL_URL', 'la_Text_Website', 'la_config_ssl_url', 'text', '', '', 10.09, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('Require_SSL', 'la_Text_Website', 'la_config_require_ssl', 'checkbox', '', '', 10.1, 0, 1); Index: trunk/core/units/general/custom_fields.php =================================================================== diff -u -N -r5110 -r5289 --- trunk/core/units/general/custom_fields.php (.../custom_fields.php) (revision 5110) +++ trunk/core/units/general/custom_fields.php (.../custom_fields.php) (revision 5289) @@ -6,14 +6,13 @@ * @todo rewrite */ class InpCustomFieldsHelper extends kHelper { - + function GetValuesHash($values_list) { - $optionValuesStr = $this->ParseConfigSQL($values_list); - $optionValuesTmp = explode(',', trim($optionValuesStr, ',')); + $optionValuesStr = trim($this->ParseConfigSQL($values_list), ','); + $optionValuesTmp = explode(',', $optionValuesStr); $optionValues = Array(); - foreach($optionValuesTmp as $optionValue) - { + foreach ($optionValuesTmp as $optionValue) { list($key, $val) = explode('=', $optionValue); $val = (substr($val,0,1) == '+') ? substr($val, 1) : $this->Application->Phrase($val); $optionValues[$key] = $val; @@ -26,75 +25,49 @@ * * @param string $valueString * @return string - * @todo Fully rewrite !!! + * @todo Apply refactoring to embedded vars stuff */ function ParseConfigSQL($valueString) { $string = trim( str_replace('', TABLE_PREFIX, $valueString) ); preg_match_all("|\{(.*)\}|U", $string, $embedded_vars, PREG_SET_ORDER); - + /* in ValueList now can use globally available variables. Usage: {$_POST['variable']|what to output if $_POST['variable'] is set} e.g. $_POST['variable']='Hello' Will output: what to output if Hello is set */ - - if($embedded_vars) - { - for($i = 0; $i < count($embedded_vars); $i++) - { + + if ($embedded_vars) { + for ($i = 0; $i < count($embedded_vars); $i++) { $embedded_var = $embedded_vars[$i][1]; $embedded_var_src = $embedded_vars[$i][0]; - + list($var_name, $pattern) = explode('|', $embedded_var); eval('$var_value = (isset('.$var_name.')?'.$var_name.':false);'); - - if ($var_value !== false) - { + + if ($var_value !== false) { $pattern = str_replace($var_name, $var_value, $pattern); $string = str_replace($embedded_var_src, $pattern, $string); } - else - { + else { $string = str_replace($embedded_var_src, '', $string); } } - } - - $start = strpos($string,''); - if(!$end) - { - $end = strlen($string); + } + + if (preg_match_all('/(.*?)<\/SQL>/', $string, $regs)) { + $i = 0; + $sql_count = count($regs[0]); + while ($i < $sql_count) { + $string = str_replace(''.$regs[2][$i].'', $this->QueryConfigSQL($regs[2][$i], $regs[1][$i]), $string); + $i++; } - $len = $end - $start; - $sql = substr($string,$start+$skip_length,$len-$skip_length); - - $sql_val = $this->QueryConfigSQL($sql, $plus); - - /*if ($start>0 && $sql_val!='') - $sql_val=",".$sql_val;*/ - if ($end < strlen($string)-$skip_length-1 && $sql_val!='') - $sql_val.=","; - - $chunk1=substr($string,0,$start); - $chunk2=substr($string,$end+$skip_length+1); - $s = $chunk1.$sql_val.$chunk2; - - $string = $s; - - $start = strpos($string, 'Conn->Query($sql); for($i=0; $i \ No newline at end of file