Index: trunk/admin/include/sections.php =================================================================== diff -u -N -r1688 -r3145 --- trunk/admin/include/sections.php (.../sections.php) (revision 1688) +++ trunk/admin/include/sections.php (.../sections.php) (revision 3145) @@ -402,7 +402,7 @@ { if($sec->Get("key")=="in-portal:root") { - $caption=stripslashes($objConfig->Get("Site_Name")); + $caption = stripslashes( strip_tags( $objConfig->Get('Site_Name') ) ); } else { @@ -571,7 +571,7 @@ } /* clsSectionList */ $objSections = new clsSectionList(); -$objSections->AddSection("in-portal:root", $objConfig->Get("Site_Name"), $objConfig->Get("Site_Name"), $admin."/","subitems.php", +$objSections->AddSection("in-portal:root", $objConfig->Get('Site_Name'), $objConfig->Get('Site_Name'), $admin."/","subitems.php", $admin."/icons/icon46_site.gif", $admin."/icons/icon24_site.gif", "in-portal:site", NULL, NULL,"in-portal:users",0,"",1, NULL,NULL,NULL, "", "la_section_overview"); Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u -N -r3136 -r3145 --- trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3136) +++ trunk/kernel/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3145) @@ -76,6 +76,7 @@ $next_template = $this->Application->GetVar('next_template'); if($next_template) $event->redirect = $next_template; + $event->SetRedirectParam('js_redirect', 1); } else { @@ -113,6 +114,8 @@ $group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup'); $session->SetField('GroupList', $group_list); $this->Application->StoreVar('UserGroups', $group_list); + + $event->SetRedirectParam('js_redirect', 1); } /** Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r2615 -r3145 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 2615) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 3145) @@ -450,4 +450,19 @@ function redirect($url) { window.location.href = $url; +} + +function update_checkbox_options($cb_mask, $hidden_id) +{ + var $kf = document.getElementById($form_prefix+'_form'); + var $tmp = ''; + for (var i = 0; i < $kf.elements.length; i++) + { + if ( $kf.elements[i].id.match($cb_mask) ) + { + if ($kf.elements[i].checked) $tmp += '|'+$kf.elements[i].value; + } + } + if($tmp.length > 0) $tmp += '|'; + document.getElementById($hidden_id).value = $tmp.replace(/,$/, ''); } \ No newline at end of file Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r2819 -r3145 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 2819) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 3145) @@ -61,6 +61,8 @@ 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'), 'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'), 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Filename' => Array('type' => 'string','not_null' => '1','default' => ''), + 'AutomaticFilename' => Array('type' => 'int','not_null' => '1','default' => '0'), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'not_null' => '1'), 'EditorsPick' => Array('type' => 'int','default' => ''), @@ -73,6 +75,7 @@ 'CreatedById' => Array('type' => 'int','not_null' => '1','default' => '0'), 'ResourceId' => Array('type' => 'int','default' => ''), 'ParentPath' => Array('type' => 'string','not_null' => '1','default' => ''), + 'NamedParentPath' => Array('type' => 'string','not_null' => '1','default' => ''), 'MetaDescription' => Array('type' => 'string','default' => ''), 'HotItem' => Array('type' => 'int','not_null' => '1','default' => '2'), 'NewItem' => Array('type' => 'int','not_null' => '1','default' => '2'), Index: trunk/kernel/units/languages/import_xml.php =================================================================== diff -u -N -r3061 -r3145 --- trunk/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 3061) +++ trunk/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 3145) @@ -122,8 +122,11 @@ function Parse($filename, $phrase_types, $module_ids, $import_mode = LANG_SKIP_EXISTING) { // define the XML parsing routines/functions to call based on the handler path - if( !file_exists($filename) ) return false; + if( !file_exists($filename) || !$phrase_types /*|| !$module_ids*/ ) return false; + $phrase_types = explode('|', substr($phrase_types, 1, -1) ); +// $module_ids = explode('|', substr($module_ids, 1, -1) ); + $this->phrase_types_allowed = array_flip($phrase_types); $this->import_mode = $import_mode; @@ -303,6 +306,9 @@ $fp = fopen($filename,'w'); if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false; + $phrase_types = explode('|', substr($phrase_types, 1, -1) ); + $module_ids = explode('|', substr($module_ids, 1, -1) ); + $this->events_hash = array_flip($this->events_hash); $lang_table = $this->Application->getUnitOption('lang','TableName'); Index: trunk/core/units/phrases/phrases_event_handler.php =================================================================== diff -u -N -r2853 -r3145 --- trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2853) +++ trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 3145) @@ -29,6 +29,13 @@ $last_module = $this->Application->GetVar('last_module'); if($last_module) $object->SetDBField('Module', $last_module); + + if($event->Special == 'export' || $event->Special == 'import') + { + $object->SetDBField('PhraseType', '|0|1|2|'); + $modules = $this->Conn->GetCol('SELECT Name FROM '.TABLE_PREFIX.'Modules'); + $object->SetDBField('Module', '|'.implode('|', $modules).'|' ); + } } /** Index: trunk/core/module_help/languages_list.txt =================================================================== diff -u -N --- trunk/core/module_help/languages_list.txt (revision 0) +++ trunk/core/module_help/languages_list.txt (revision 3145) @@ -0,0 +1 @@ + super safassaf
\ No newline at end of file Index: trunk/core/units/languages/languages_event_handler.php =================================================================== diff -u -N -r3014 -r3145 --- trunk/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 3014) +++ trunk/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 3145) @@ -177,6 +177,8 @@ if($items_info) { list($id,$field_values) = each($items_info); + $object =& $this->Application->recallObject('phrases.import', 'phrases', Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); $filename = getArrayValue($field_values, 'LangFile', 'tmp_name'); if( filesize($filename) ) @@ -337,6 +339,8 @@ if($items_info) { list($id,$field_values) = each($items_info); + $object =& $this->Application->recallObject('phrases.export', 'phrases', Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); $lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') ); Index: trunk/admin/images/toolbar/tool_export_f2.gif =================================================================== diff -u -N Binary files differ Index: trunk/admin/images/toolbar/tool_export_f3.gif =================================================================== diff -u -N Binary files differ Index: trunk/kernel/include/item.php =================================================================== diff -u -N -r3122 -r3145 --- trunk/kernel/include/item.php (.../item.php) (revision 3122) +++ trunk/kernel/include/item.php (.../item.php) (revision 3145) @@ -20,6 +20,8 @@ var $ReviewSortOrder; var $ReviewPerPageVar; + var $TitleField = ''; + function clsItem($FullItem=FALSE) { $this->clsParsedItem(); @@ -1106,6 +1108,33 @@ $sql = 'SELECT ParentId FROM '.$prefix.'Category WHERE CategoryId = '.$cat_id; if($cat_id > 0) $this->refreshLastUpdate( $db->GetOne($sql) ); } + + function StripDisallowed($string) + { + $not_allowed = Array(' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|'); + $string = str_replace($not_allowed, '_', $string); + return preg_replace('/(_+)/', '_', $string); + } + function GenerateFilename() + { + if ( !$this->Get('AutomaticFilename') && $this->Get('Filename') ) return false; + $name = $this->StripDisallowed( $this->Get($this->TitleField) ); + if ( $name != $this->Get('Filename') ) $this->Set('Filename', $name); + } + + function Update($UpdatedBy = null) + { + $this->GenerateFilename(); + parent::Update($UpdatedBy); + + } + + function Create() + { + $this->GenerateFilename(); + parent::Create(); + } + } ?> \ No newline at end of file Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r3137 -r3145 --- trunk/core/kernel/application.php (.../application.php) (revision 3137) +++ trunk/core/kernel/application.php (.../application.php) (revision 3145) @@ -189,10 +189,10 @@ $GLOBALS['debugger']->profileFinish('kernel4_startup'); } - if( defined('CMS') && CMS == 1 && !$this->GetVar('admin') && !$this->IsAdmin() ) - { - define('MOD_REWRITE', 1); - } + $cms_on = defined('CMS') && CMS; + $rewrite_on = $this->ConfigValue('UseModRewrite'); + $admin_on = $this->GetVar('admin') || $this->IsAdmin(); + define('MOD_REWRITE', ($rewrite_on || $cms_on) && !$admin_on ? 1 : 0); $this->InitDone = true; return true; @@ -755,7 +755,8 @@ unset($params['anchor']); } - if (defined('MOD_REWRITE') && MOD_REWRITE) { + if ( $this->RewriteURLs() ) + { $env = $this->BuildEnv('', $params, $pass, $pass_events, false); $env = ltrim($env, ':-'); @@ -765,7 +766,8 @@ $ret = rtrim($this->BaseURL($prefix, $ssl).$t.'.html/'.$env.'/'.$sid.$map_link, '/'); } - else { + else + { $env = $this->BuildEnv($t, $params, $pass, $pass_events); $ret = $this->BaseURL($prefix, $ssl).$index_file.'?'.$env.$map_link; } @@ -776,7 +778,7 @@ function BuildEnv($t, $params, $pass='all', $pass_events=false, $env_var=true) { $session =& $this->recallObject('Session'); - $sid = $session->NeedQueryString() && !(defined('MOD_REWRITE') && MOD_REWRITE) ? $this->GetSID() : ''; + $sid = $session->NeedQueryString() && !$this->RewriteURLs() ? $this->GetSID() : ''; if( getArrayValue($params,'admin') == 1 ) $sid = $this->GetSID(); $ret = ''; @@ -877,6 +879,9 @@ if ($t == '' || $t === true) $t = $this->GetVar('t'); // pass prefixes and special from previous url + $js_redirect = getArrayValue($params, 'js_redirect'); + if( isset($params['js_redirect']) ) unset($params['js_redirect']); + if (!isset($params['pass'])) $params['pass'] = 'all'; $params['__URLENCODE__'] = 1; $location = $this->HREF($t, $prefix, $params, $index_file); @@ -900,13 +905,22 @@ } else { - if(headers_sent() != '') + if($js_redirect) { - echo ''; + $this->InitParser(); + $block_params = Array('name' => 'redirect', 'redirect_to_js' => addslashes($a_location), 'redirect_to' => $a_location ); + echo $this->ParseBlock($block_params); } else { - header("$location"); + if(headers_sent() != '') + { + echo ''; + } + else + { + header("$location"); + } } } @@ -1122,6 +1136,16 @@ } /** + * Apply url rewriting used by mod_rewrite or not + * + * @return bool + */ + function RewriteURLs() + { + return defined('MOD_REWRITE') && MOD_REWRITE; + } + + /** * Reads unit (specified by $prefix) * option specified by $option * Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.2.sql =================================================================== diff -u -N -r2801 -r3145 --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.2.sql (.../inportal_upgrade_v1.1.2.sql) (revision 2801) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.2.sql (.../inportal_upgrade_v1.1.2.sql) (revision 3145) @@ -1,4 +1,4 @@ -CREATE TABLE Visits (VisitId int(11) NOT NULL auto_increment, VisitDate int(10) unsigned NOT NULL default '0', Referer varchar(255) NOT NULL default '', IPAddress varchar(15) NOT NULL default '', AffiliateId int(10) unsigned NOT NULL default '0', PortalUserId int(11) NOT NULL default '0', PRIMARY KEY (VisitId) ); +CREATE TABLE Visits (VisitId int(11) NOT NULL auto_increment, VisitDate int(10) unsigned NOT NULL default '0', Referer varchar(255) NOT NULL default '', IPAddress varchar(15) NOT NULL default '', AffiliateId int(10) unsigned NOT NULL default '0', PortalUserId int(11) NOT NULL default '0', PRIMARY KEY (VisitId), KEY PortalUserId (PortalUserId), KEY AffiliateId (AffiliateId) ); INSERT INTO ConfigurationAdmin VALUES ('FirstDayOfWeek', 'la_Text_Date_Time_Settings', 'la_config_first_day_of_week', 'select', '', '0=la_sunday,1=la_monday', 8, 1); INSERT INTO ConfigurationValues VALUES ('FirstDayOfWeek', '1', 'In-Portal', 'in-portal:configure_general'); Index: trunk/admin/tree/tree.php =================================================================== diff -u -N -r2853 -r3145 --- trunk/admin/tree/tree.php (.../tree.php) (revision 2853) +++ trunk/admin/tree/tree.php (.../tree.php) (revision 3145) @@ -14,7 +14,7 @@ include_once($pathtoroot.$admin."/include/sections.php"); - $ServerName = $objConfig->Get("Site_Name"); + $ServerName = $objConfig->Get('Site_Name'); $rootLink = $adminURL."/subitems.php?env=".BuildEnv()."§ion=in-portal:root"; $charset = GetRegionalOption('Charset'); ?> Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r3046 -r3145 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3046) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3145) @@ -200,7 +200,7 @@ if ($event->status == erSUCCESS){ if (!$from_user_name) { - $from_user_name = $this->Application->ConfigValue('Site_Name'); + $from_user_name = strip_tags( $this->Application->ConfigValue('Site_Name') ); } $sql = 'INSERT INTO '.TABLE_PREFIX.'EmailLog SET fromuser = '.$this->Conn->qstr($from_user_name.' ('.$from_user_email.')').', Index: trunk/globals.php =================================================================== diff -u -N -r3124 -r3145 --- trunk/globals.php (.../globals.php) (revision 3124) +++ trunk/globals.php (.../globals.php) (revision 3145) @@ -1656,23 +1656,75 @@ $update =& $GLOBALS[$prefix.'_var_list_update']; //echo "VAR: [$main]; VAR_UPDATE: [$update]
"; + // if update var count is zero, then do nothing + if( !is_array($update) || count($update) == 0 ) return ''; + // ensure that we have no empty values in enviroment variable - foreach($update as $vl_key => $vl_value) + foreach($update as $vl_key => $vl_value) { if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]); - - // if update var count is zero, then do nothing - if(count($update) == 0) return ''; + } - foreach($main as $vl_key => $vl_value) + foreach($main as $vl_key => $vl_value) { if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]); + } $ret = Array(); - foreach($var_list as $var_name) + foreach($var_list as $var_name) { $ret[] = GetEnvVar($prefix, $var_name); + } + + // Removing all var_list_udpate + $keys = array_keys($update); + foreach ($keys as $key) { + unset($update[$key]); + } return ':'.$prefix.implode('-',$ret); } +// functions for dealign with enviroment variable construction +function GenerateModuleEnv_NEW($prefix, $var_list) +{ + // globalize module varible arrays + $main =& $GLOBALS[$prefix.'_var_list']; + $update =& $GLOBALS[$prefix.'_var_list_update']; + //echo "VAR: [$main]; VAR_UPDATE: [$update]
"; + + if ( isset($update) && $update ) + { + // ensure that we have no empty values in enviroment variable + foreach($update as $vl_key => $vl_value) { + if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]); + } + + $app =& kApplication::Instance(); + $passed = $app->GetVar('prefixes_passed'); + $passed[] = $prefix; + $app->SetVar('prefixes_passed', $passed); + } + else + { + return Array(); + } + + foreach($main as $vl_key => $vl_value) { + if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]); + } + + $ret = Array(); + foreach($var_list as $src_name => $dst_name) { + $ret[$dst_name] = GetEnvVar($prefix, $src_name); + } + + // Removing all var_list_udpate + if ( isset($update) && $update ) + { + $keys = array_keys($update); + foreach ($keys as $key) unset($update[$key]); + } + return $ret; +} + function GetEnvVar($prefix, $name) { // get variable from template variable's list @@ -1891,7 +1943,7 @@ */ function set_cookie($name, $value, $expire = 0) { - $cookie_path = IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH; + $cookie_path = IsAdmin() ? rtrim(BASE_PATH, '/').'/admin' : BASE_PATH; setcookie($name, $value, $expire, $cookie_path, $_SERVER['HTTP_HOST']); } @@ -1929,35 +1981,25 @@ } } - function HREF_Wrapper($t = '', $params = null, $index_file = null ) + /** + * Builds up K4 url from data supplied by in-portal + * + * @param string $t template + * @param Array $params + * @param string $index_file + * @return string + */ + function HREF_Wrapper($t = '', $params = null, $index_file = null) { - $ret = GetIndexURL(2).'?env='.BuildEnv(); - if( isset($params) ) + $url_params = BuildEnv_NEW(); + if( isset($params) ) $url_params = array_merge_recursive2($url_params, $params); + if(!$t) { - $map_link = ''; - if( is_array($params) ) - { - if( isset($params['anchor']) ) - { - $map_link = '#'.$params['anchor']; - unset($params['anchor']); - } - foreach ($params as $param_name => $param_value) - { - $ret .= '&'.$param_name.'='.urlencode($param_value); - } - } - else - { - $app =& kApplication::Instance(); - $app->Debugger->appendTrace(); - trigger_error('Incorrect HREF_Wrapper call', E_USER_WARNING); - } + $t = $url_params['t']; + unset($url_params['t']); } - return $ret.$map_link; - - /*$application =& kApplication::Instance(); - return $application->HREF($t, '', $params, $index_file);*/ + $app =& kApplication::Instance(); + return $app->HREF($t, '', $url_params, $index_file); } /** Index: trunk/kernel/parser.php =================================================================== diff -u -N -r3124 -r3145 --- trunk/kernel/parser.php (.../parser.php) (revision 3124) +++ trunk/kernel/parser.php (.../parser.php) (revision 3145) @@ -39,6 +39,16 @@ return $ret; } +function m_BuildEnv_NEW() +{ + global $m_var_list, $m_var_list_update; + $module_vars = Array( 'cat' => 'm_cat_id', 'p' => 'm_cat_page', 'lang' => 'm_lang', + 'theme' => 'm_theme', 'opener' => 'm_opener'); + $ret = GenerateModuleEnv_NEW('m', $module_vars); + if( isset($GLOBALS['m_var_list_update']['cat']) ) unset($GLOBALS['m_var_list_update']['cat']); + return $ret; +} + function m_GetVar($name) { // get variable from template variable's list @@ -1231,7 +1241,7 @@ { global $objConfig, $objCatList; - $ret = $objConfig->Get("Site_Name"); + $ret = strip_tags( $objConfig->Get('Site_Name') ); if(getArrayValue($attribs,'_fullpath') || getArrayValue($attribs,'_currentcategory')) { $CurrentCat = $objCatList->CurrentCategoryID(); Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r2801 -r3145 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 2801) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 3145) @@ -18,6 +18,8 @@ Type int(11) NOT NULL default '0', ParentId int(11) NOT NULL default '0', Name varchar(255) NOT NULL default '', + Filename text NOT NULL, + AutomaticFilename tinyint(3) unsigned NOT NULL default '0', Description text NOT NULL, CreatedOn int(11) NOT NULL default '0', EditorsPick tinyint(4) default NULL, @@ -30,6 +32,7 @@ CreatedById int(11) NOT NULL default '0', ResourceId int(11) default NULL, ParentPath text NOT NULL, + NamedParentPath text NOT NULL, MetaDescription varchar(255) default NULL, HotItem int(11) NOT NULL default '2', NewItem int(11) NOT NULL default '2', Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.4.sql =================================================================== diff -u -N -r3019 -r3145 --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.4.sql (.../inportal_upgrade_v1.1.4.sql) (revision 3019) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.4.sql (.../inportal_upgrade_v1.1.4.sql) (revision 3145) @@ -1,4 +1,14 @@ INSERT INTO ConfigurationValues VALUES ('SessionCookieName', 'sid', 'In-Portal', 'in-portal:configure_general'); +INSERT INTO ConfigurationValues VALUES ('UseModRewrite', '0', 'In-Portal', 'in-portal:configure_general'); + INSERT INTO ConfigurationAdmin VALUES ('SessionCookieName', 'la_Text_Website', 'la_prompt_session_cookie_name', 'text', '', '', 8, 1); +INSERT INTO ConfigurationAdmin VALUES ('UseModRewrite', 'la_Text_Website', 'la_config_use_modrewrite', 'checkbox', '', '', 14, 1); +ALTER TABLE Category ADD Filename text NOT NULL AFTER Name; +ALTER TABLE Category ADD AutomaticFilename TINYINT UNSIGNED NOT NULL AFTER Filename ; +ALTER TABLE Category ADD NamedParentPath TEXT NOT NULL AFTER ParentPath; + +ALTER TABLE Visits ADD INDEX (AffiliateId); +ALTER TABLE Visits ADD INDEX (PortalUserId); + UPDATE Modules SET Version = '1.1.4' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r2893 -r3145 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 2893) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 3145) @@ -104,9 +104,10 @@ else { include_once($file); } - - $prefix=$config['Prefix']; - $config['BasePath']=$full_path; + + if ( !isset($config) || !$config ) continue; + $prefix = $config['Prefix']; + $config['BasePath'] = $full_path; $this->configData[$prefix] = $config; } } Index: trunk/admin/include/mainscript.php =================================================================== diff -u -N -r2811 -r3145 --- trunk/admin/include/mainscript.php (.../mainscript.php) (revision 2811) +++ trunk/admin/include/mainscript.php (.../mainscript.php) (revision 3145) @@ -69,7 +69,7 @@ { $ampm = "true"; } -$SiteName = addslashes( $GLOBALS['objConfig']->Get('Site_Name') ); +$SiteName = addslashes( strip_tags( $GLOBALS['objConfig']->Get('Site_Name') ) ); require_once($pathtoroot.$admin."/lv/js/js_lang.php"); print << name="" id="_" value="" onclick="">  - - name="[]" id="_" value="">  - - - "> @@ -220,6 +215,15 @@ + + + id="_" value="" onclick="update_checkbox_options(/^_([0-9-]+)/, '');">  + + + + id="_" value="" onclick="update_checkbox_options(/^_([0-9-]+)/, '');">  + + "> @@ -229,6 +233,7 @@ +   Index: trunk/kernel/include/modules.php =================================================================== diff -u -N -r3129 -r3145 --- trunk/kernel/include/modules.php (.../modules.php) (revision 3129) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 3145) @@ -208,7 +208,10 @@ $builder_name = $key . "_BuildEnv"; if(function_exists($builder_name)) { - $GLOBALS[$key.'_var_list_update']['test'] = 'test'; + if($key == 'm') + { + $GLOBALS[$key.'_var_list_update']['test'] = 'test'; + } $env .= $builder_name(); } } @@ -232,6 +235,38 @@ return $env; } +function BuildEnv_NEW($mod_prefix = false) +{ + global $var_list, $var_list_update, $mod_prefix, $objSession; + + $t = getArrayValue($var_list_update, 't') ? $var_list_update['t'] : $var_list['t']; + if($t == '_referer_') $t = $objSession->GetVariable('Template_Referer'); + if ( substr($t, 0, strlen('kernel4:') ) == 'kernel4:' ) $t = substr($t, strlen('kernel4:') ); + + $url_params = Array('t' => $t); + $app =& kApplication::Instance(); + $app->SetVar('prefixes_passed', Array() ); + + if( is_array($mod_prefix) ) + { + foreach($mod_prefix as $key => $value) + { + $builder_name = $key.'_BuildEnv_NEW'; + if( function_exists($builder_name) ) + { + if($key == 'm') + { + $GLOBALS[$key.'_var_list_update']['test'] = 'test'; + } + $url_params = array_merge_recursive2($url_params, $builder_name() ); + } + } + } + + $url_params['pass'] = implode( ',', $app->GetVar('prefixes_passed') ); + return $url_params; +} + function CategoryActionFunc($basename,$CatList) { global $mod_prefix; Index: trunk/admin/category/addcategory.php =================================================================== diff -u -N -r2853 -r3145 --- trunk/admin/category/addcategory.php (.../addcategory.php) (revision 2853) +++ trunk/admin/category/addcategory.php (.../addcategory.php) (revision 3145) @@ -179,6 +179,22 @@ + + > + + + Get('AutomaticFilename') == 1) echo ' checked'; ?> onchange="reflect_filename();"> + +   + + > + + + + +   + + > @@ -294,6 +310,12 @@
Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -N -r3100 -r3145 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 3100) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 3145) @@ -47,6 +47,7 @@ INSERT INTO ConfigurationAdmin VALUES ('Require_SSL', 'la_Text_Website', 'la_config_require_ssl', 'checkbox', '', '', 12, '1'); INSERT INTO ConfigurationAdmin VALUES ('Force_HTTP_When_SSL_Not_Required', 'la_Text_Website', 'la_config_force_http', 'checkbox', '', '', 13, '1'); INSERT INTO ConfigurationAdmin VALUES ('SessionCookieName', 'la_Text_Website', 'la_prompt_session_cookie_name', 'text', '', '', 8, 1); +INSERT INTO ConfigurationAdmin VALUES ('UseModRewrite', 'la_Text_Website', 'la_config_use_modrewrite', 'checkbox', '', '', 14, 1); INSERT INTO ConfigurationValues VALUES ('Columns_Category', '2', 'In-Portal', 'Categories') INSERT INTO ConfigurationValues VALUES ('DomainSelect','1','In-Portal','in-portal:configure_general') @@ -169,6 +170,7 @@ INSERT INTO ConfigurationValues VALUES ('Require_SSL', '', 'In-Portal', 'in-portal:configure_general'); INSERT INTO ConfigurationValues VALUES ('Force_HTTP_When_SSL_Not_Required', '1', 'In-Portal', 'in-portal:configure_general'); INSERT INTO ConfigurationValues VALUES ('SessionCookieName', 'sid', 'In-Portal', 'in-portal:configure_general'); +INSERT INTO ConfigurationValues VALUES ('UseModRewrite', '0', 'In-Portal', 'in-portal:configure_general'); INSERT INTO Events VALUES (30, 'USER.ADD', 1, 0, 'In-Portal:Users', 'la_event_user.add', 0) INSERT INTO Events VALUES (32, 'USER.ADD', 2, 0, 'In-Portal:Users', 'la_event_user.add', 1) Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r3114 -r3145 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3114) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3145) @@ -52,7 +52,6 @@ return $this->Application->ParseBlock($block_params); } - function SearchKeyword($params) { $list =& $this->GetList($params); @@ -640,22 +639,39 @@ $block_params['name'] = $this->SelectParam($params, 'render_as,block'); $block_params['field'] = $params['field']; $block_params['pass_params'] = 'true'; + $block_params['field_name'] = $this->InputName($params); + $block_params['PrefixSpecial'] = $this->getPrefixSpecial(); $selected_param_name = getArrayValue($params,'selected_param'); if(!$selected_param_name) $selected_param_name = $params['selected']; $selected = $params['selected']; $o = ''; if( $this->HasParam($params,'no_empty') && !getArrayValue($options['options'],'') ) array_shift($options['options']); - foreach ($options['options'] as $key => $val) { - $block_params['key'] = $key; - $block_params['option'] = $val; - $block_params['field_name'] = $this->InputName($params); - $block_params[$selected_param_name] = ( $key == $value ? ' '.$selected : ''); - $block_params['PrefixSpecial'] = $this->getPrefixSpecial(); - $o .= $this->Application->ParseBlock($block_params, 1); - } + if( strpos($value, '|') !== false ) + { + // multiple selection checkboxes + $value = explode('|', substr($value, 1, -1) ); + foreach ($options['options'] as $key => $val) + { + $block_params['key'] = $key; + $block_params['option'] = $val; + $block_params[$selected_param_name] = ( in_array($key, $value) ? ' '.$selected : ''); + $o .= $this->Application->ParseBlock($block_params, 1); + } + } + else + { + // single selection radio or checkboxes + foreach ($options['options'] as $key => $val) + { + $block_params['key'] = $key; + $block_params['option'] = $val; + $block_params[$selected_param_name] = ( $key == $value ? ' '.$selected : ''); + $o .= $this->Application->ParseBlock($block_params, 1); + } + } return $o; } @@ -837,7 +853,9 @@ $id = $object->GetID(); } - return $prefix_special.'['.$id.']['.$params['field'].']'; + $ret = $prefix_special.'['.$id.']['.$params['field'].']'; + if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/'); + return $ret; } Index: trunk/core/units/languages/import_xml.php =================================================================== diff -u -N -r3061 -r3145 --- trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 3061) +++ trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 3145) @@ -122,8 +122,11 @@ function Parse($filename, $phrase_types, $module_ids, $import_mode = LANG_SKIP_EXISTING) { // define the XML parsing routines/functions to call based on the handler path - if( !file_exists($filename) ) return false; + if( !file_exists($filename) || !$phrase_types /*|| !$module_ids*/ ) return false; + $phrase_types = explode('|', substr($phrase_types, 1, -1) ); +// $module_ids = explode('|', substr($module_ids, 1, -1) ); + $this->phrase_types_allowed = array_flip($phrase_types); $this->import_mode = $import_mode; @@ -303,6 +306,9 @@ $fp = fopen($filename,'w'); if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false; + $phrase_types = explode('|', substr($phrase_types, 1, -1) ); + $module_ids = explode('|', substr($module_ids, 1, -1) ); + $this->events_hash = array_flip($this->events_hash); $lang_table = $this->Application->getUnitOption('lang','TableName'); Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -N -r3136 -r3145 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3136) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 3145) @@ -76,6 +76,7 @@ $next_template = $this->Application->GetVar('next_template'); if($next_template) $event->redirect = $next_template; + $event->SetRedirectParam('js_redirect', 1); } else { @@ -113,6 +114,8 @@ $group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup'); $session->SetField('GroupList', $group_list); $this->Application->StoreVar('UserGroups', $group_list); + + $event->SetRedirectParam('js_redirect', 1); } /** Index: trunk/admin/include/mainscript.js =================================================================== diff -u -N -r2811 -r3145 --- trunk/admin/include/mainscript.js (.../mainscript.js) (revision 2811) +++ trunk/admin/include/mainscript.js (.../mainscript.js) (revision 3145) @@ -1,7 +1,7 @@ Get('Site_Name') ); +$SiteName = addslashes( strip_tags( $GLOBALS['objConfig']->Get('Site_Name') ) ); $env2 = BuildEnv(); print << Index: trunk/kernel/admin_templates/regional/languages_import.tpl =================================================================== diff -u -N -r2716 -r3145 --- trunk/kernel/admin_templates/regional/languages_import.tpl (.../languages_import.tpl) (revision 2716) +++ trunk/kernel/admin_templates/regional/languages_import.tpl (.../languages_import.tpl) (revision 3145) @@ -34,16 +34,7 @@ - - []" id="_" value="">  - - - - []" id="_" value="">  - - - Index: trunk/kernel/units/phrases/phrases_event_handler.php =================================================================== diff -u -N -r2853 -r3145 --- trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 2853) +++ trunk/kernel/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 3145) @@ -29,6 +29,13 @@ $last_module = $this->Application->GetVar('last_module'); if($last_module) $object->SetDBField('Module', $last_module); + + if($event->Special == 'export' || $event->Special == 'import') + { + $object->SetDBField('PhraseType', '|0|1|2|'); + $modules = $this->Conn->GetCol('SELECT Name FROM '.TABLE_PREFIX.'Modules'); + $object->SetDBField('Module', '|'.implode('|', $modules).'|' ); + } } /** Index: trunk/kernel/units/categories/categories_config.php =================================================================== diff -u -N -r2819 -r3145 --- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 2819) +++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 3145) @@ -61,6 +61,8 @@ 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'), 'ParentId' => Array('type' => 'int','not_null' => '1','default' => '0'), 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Filename' => Array('type' => 'string','not_null' => '1','default' => ''), + 'AutomaticFilename' => Array('type' => 'int','not_null' => '1','default' => '0'), 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), 'CreatedOn' => Array('formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'not_null' => '1'), 'EditorsPick' => Array('type' => 'int','default' => ''), @@ -73,6 +75,7 @@ 'CreatedById' => Array('type' => 'int','not_null' => '1','default' => '0'), 'ResourceId' => Array('type' => 'int','default' => ''), 'ParentPath' => Array('type' => 'string','not_null' => '1','default' => ''), + 'NamedParentPath' => Array('type' => 'string','not_null' => '1','default' => ''), 'MetaDescription' => Array('type' => 'string','default' => ''), 'HotItem' => Array('type' => 'int','not_null' => '1','default' => '2'), 'NewItem' => Array('type' => 'int','not_null' => '1','default' => '2'), Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -N -r3056 -r3145 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 3056) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 3145) @@ -175,7 +175,7 @@ } if(!strlen($FromAddr)) { - $FromName = $objConfig->Get("Site_Name"); + $FromName = strip_tags( $objConfig->Get('Site_Name') ); $FromAddr = $objConfig->Get("Smtp_AdminMailFrom"); } @@ -235,7 +235,7 @@ if(!strlen($FromAddr)) { - $FromName = $objConfig->Get("Site_Name"); + $FromName = strip_tags( $objConfig->Get('Site_Name') ); $FromAddr = $objConfig->Get("Smtp_AdminMailFrom"); } // echo $this->Event; @@ -282,7 +282,7 @@ $subject = $this->ParseSection($this->subject); $body = $this->ParseSection($this->body); - $FromName = $objConfig->Get("Site_Name"); + $FromName = strip_tags( $objConfig->Get('Site_Name') ); $FromAddr = $objConfig->Get("Smtp_AdminMailFrom"); if(strlen($FromAddr)) { Index: trunk/kernel/units/languages/languages_event_handler.php =================================================================== diff -u -N -r3014 -r3145 --- trunk/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 3014) +++ trunk/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 3145) @@ -177,6 +177,8 @@ if($items_info) { list($id,$field_values) = each($items_info); + $object =& $this->Application->recallObject('phrases.import', 'phrases', Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); $filename = getArrayValue($field_values, 'LangFile', 'tmp_name'); if( filesize($filename) ) @@ -337,6 +339,8 @@ if($items_info) { list($id,$field_values) = each($items_info); + $object =& $this->Application->recallObject('phrases.export', 'phrases', Array('skip_autoload' => true) ); + $object->SetFieldsFromHash($field_values); $lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') ); Index: trunk/admin/images/toolbar/tool_export.gif =================================================================== diff -u -N Binary files differ Index: trunk/kernel/module_help/languages_list.txt =================================================================== diff -u -N --- trunk/kernel/module_help/languages_list.txt (revision 0) +++ trunk/kernel/module_help/languages_list.txt (revision 3145) @@ -0,0 +1 @@ + super safassaf
\ No newline at end of file Index: trunk/kernel/action.php =================================================================== diff -u -N -r2853 -r3145 --- trunk/kernel/action.php (.../action.php) (revision 2853) +++ trunk/kernel/action.php (.../action.php) (revision 3145) @@ -780,7 +780,7 @@ $objEditItems->SourceTable = $objSession->GetEditTable("Category"); $cat = $objEditItems->Add($_POST["ParentId"], $_POST["cat_name"], inp_escape($_POST["cat_desc"],$html), $CreatedOn, $cat_pick, $Status, $Hot, $New, $Pop, $_POST["Priority"], - $_POST["meta_keywords"],$_POST["meta_desc"]); + $_POST["meta_keywords"],$_POST["meta_desc"], GetVar('auto_filename'), GetVar('filename') ); $objCustomEdit = new clsCustomDataList($objSession->GetEditTable("CustomMetaData")); $objCustomEdit->LoadResource($cat->Get("ResourceId")); $CustomFields = new clsCustomFieldList(1); @@ -831,7 +831,7 @@ } // check if name of cat isn't changed: end - $cat = $objEditItems->Edit_Category($_POST["CategoryId"],inp_escape($_POST["cat_name"],$html), inp_escape($_POST["cat_desc"],$html), $CreatedOn, $cat_pick, $Status, $Hot, $New, $Pop, $_POST["Priority"], $_POST["meta_keywords"], $_POST["meta_desc"]); + $cat = $objEditItems->Edit_Category($_POST["CategoryId"],inp_escape($_POST["cat_name"],$html), inp_escape($_POST["cat_desc"],$html), $CreatedOn, $cat_pick, $Status, $Hot, $New, $Pop, $_POST["Priority"], $_POST["meta_keywords"], $_POST["meta_desc"], GetVar('auto_filename'), GetVar('filename') ); $objCustomEdit = new clsCustomDataList($objSession->GetEditTable("CustomMetaData")); $objCustomEdit->LoadResource($cat->Get("ResourceId")); Index: trunk/admin/email/do_send.php =================================================================== diff -u -N -r3056 -r3145 --- trunk/admin/email/do_send.php (.../do_send.php) (revision 3056) +++ trunk/admin/email/do_send.php (.../do_send.php) (revision 3145) @@ -56,7 +56,7 @@ if(!strlen(trim($FromName))) { - $FromName = $objConfig->Get("Site_Name"); + $FromName = strip_tags( $objConfig->Get('Site_Name') ); } $TargetURL = $_SERVER["PHP_SELF"]."?".$envar.'&destform=popup'; Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r3046 -r3145 --- trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3046) +++ trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 3145) @@ -200,7 +200,7 @@ if ($event->status == erSUCCESS){ if (!$from_user_name) { - $from_user_name = $this->Application->ConfigValue('Site_Name'); + $from_user_name = strip_tags( $this->Application->ConfigValue('Site_Name') ); } $sql = 'INSERT INTO '.TABLE_PREFIX.'EmailLog SET fromuser = '.$this->Conn->qstr($from_user_name.' ('.$from_user_email.')').', Index: trunk/kernel/admin_templates/regional/languages_export.tpl =================================================================== diff -u -N -r1768 -r3145 --- trunk/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 1768) +++ trunk/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 3145) @@ -41,14 +41,6 @@   - - []" id="_" value="">  - - - - []" id="_" value="">  - - Index: trunk/admin/images/toolbar/tool_import_f2.gif =================================================================== diff -u -N Binary files differ Index: trunk/admin/images/toolbar/tool_import_f3.gif =================================================================== diff -u -N Binary files differ Index: trunk/kernel/include/category.php =================================================================== diff -u -N -r3124 -r3145 --- trunk/kernel/include/category.php (.../category.php) (revision 3124) +++ trunk/kernel/include/category.php (.../category.php) (revision 3145) @@ -37,6 +37,20 @@ } } + + function StripDisallowed($string) + { + $not_allowed = Array(' ', '\\', '/', ':', '*', '?', '"', '<', '>', '|'); + $string = str_replace($not_allowed, '_', $string); + return preg_replace('/(_+)/', '_', $string); + } + + function GenerateFilename() + { + if ( !$this->Get('AutomaticFilename') && $this->Get('Filename') ) return false; + $name = $this->StripDisallowed( $this->Get('Name') ); + if ( $name != $this->Get('Filename') ) $this->Set('Filename', $name); + } function ClearCacheData() { @@ -93,20 +107,18 @@ function Update($UpdatedBy=NULL) { + $this->GenerateFilename(); parent::Update($UpdatedBy); - if($this->tablename==GetTablePrefix()."Category") - $this->ClearCacheData(); + if ($this->tablename == GetTablePrefix().'Category') $this->ClearCacheData(); } function Create() { - if( (int) $this->Get("CreatedOn") == 0) { - $this->Set("CreatedOn",date("U")); - } + $this->GenerateFilename(); + if( (int)$this->Get('CreatedOn') == 0 ) $this->Set('CreatedOn', date('U') ); + parent::Create(); - if($this->tablename == GetTablePrefix()."Category") { - $this->ClearCacheData(); - } + if ($this->tablename == GetTablePrefix().'Category') $this->ClearCacheData(); } function SetParentId($value) @@ -239,37 +251,36 @@ return $dataValid; } - function UpdateCachedPath() - { - if($this->UsingTempTable()==TRUE) - return; - $Id = $this->Get("CategoryId"); - $Id2 = $Id; - $NavPath = ""; - $path = array(); - do - { - $rs = $this->adodbConnection->Execute("SELECT ParentId,Name from ".$this->tablename." where CategoryId='$Id2'"); - $path[] = $Id2; - $nav[] = $rs->fields["Name"]; - if ($rs && !$rs->EOF) - { - //echo $path; - $Id2 = $rs->fields["ParentId"]; - - } - else - $Id2="0"; //to prevent infinite loop - } while ($Id2 != "0"); - $parentpath = "|".implode("|",array_reverse($path))."|"; - $NavBar = implode(">",array_reverse($nav)); - //echo "
\n"; - //$rs = $this->adodbConnection->Execute("update Category set ParentPath='$path' where CategoryId='$Id'"); - if($this->Get("ParentPath")!=$parentpath || $this->Get("CachedNavbar")!=$NavBar) + function UpdateCachedPath() + { + if( $this->UsingTempTable() == true) return ; + $Id = $this->Get('CategoryId'); + $Id2 = $Id; + + $path_parts = Array(); + $nav_parts = Array(); + $named_parts = Array(); + + do + { + $rs = $this->adodbConnection->Execute('SELECT ParentId, Name, Filename FROM '.$this->tablename.' WHERE CategoryId = '.$Id2); + $path_parts[] = $Id2; + $nav_parts[] = $rs->fields['Name']; + $named_parts[] = $rs->fields['Filename']; + $Id2 = ($rs && !$rs->EOF) ? $rs->fields['ParentId'] : '0'; + + }while ($Id2 != '0'); + + $parent_path = '|'.implode('|', array_reverse($path_parts) ).'|'; + $nav_bar = implode('>', array_reverse($nav_parts) ); + $named_path = implode('/', $named_parts); + + if($this->Get('ParentPath') != $parent_path || $this->Get('CachedNavbar') != $nav_bar || $this->Get('NamedParentPath') != $named_path ) { - $this->Set("ParentPath",$parentpath); - $this->Set("CachedNavbar",$NavBar); - $this->Update(); + $this->Set('ParentPath', $parent_path); + $this->Set('CachedNavbar', $nav_bar); + $this->Set('NamedParentPath', $named_path); + $this->Update(); } } @@ -1989,54 +2000,58 @@ return $nav; } - function &Add($ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, $Pop, - $Priority, $MetaKeywords,$MetaDesc) - { - global $objSession; + function &Add( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, $Pop, + $Priority, $MetaKeywords,$MetaDesc, $auto_filename = 1, $filename = '') + { + global $objSession; - $UserId = $objSession->Get("UserId"); + $UserId = $objSession->Get('UserId'); - $d = new clsCategory(NULL); - $d->tablename = $this->SourceTable; - if($d->UsingTempTable()) - $d->Set("CategoryId",-1); - $d->idfield = "CategoryId"; - $d->Set(array("ParentId", "Name", "Description", "CreatedOn", "EditorsPick", "Status", "HotItem", - "NewItem","PopItem", "Priority", "MetaKeywords", "MetaDescription", "CreatedById"), - array($ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, - $Pop, $Priority, $MetaKeywords,$MetaDesc, $UserId)); + $d = new clsCategory(NULL); + $filename = $d->StripDisallowed($filename); + $d->tablename = $this->SourceTable; + + if( $d->UsingTempTable() ) $d->Set('CategoryId', -1); + $d->idfield = 'CategoryId'; + + $d->Set(Array( 'ParentId', 'Name', 'Description', 'CreatedOn', 'EditorsPick', 'Status', 'HotItem', + 'NewItem','PopItem', 'Priority', 'MetaKeywords', 'MetaDescription', 'CreatedById', + 'AutomaticFilename', 'Filename'), + Array( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, + $Pop, $Priority, $MetaKeywords,$MetaDesc, $UserId, $auto_filename, $filename) ); - $d->Create(); - if($Status==1) - { - $d->SendUserEventMail("CATEGORY.ADD",$objSession->Get("PortalUserId")); - $d->SendAdminEventMail("CATEGORY.ADD"); - } - else - { - $d->SendUserEventMail("CATEGORY.ADD.PENDING",$objSession->Get("PortalUserId")); - $d->SendAdminEventMail("CATEGORY.ADD.PENDING"); - } - $d->UpdateCachedPath(); - //RunUp($ParentId, "Increment_Count"); - - return $d; + $d->Create(); + if($Status == 1) + { + $d->SendUserEventMail("CATEGORY.ADD",$objSession->Get("PortalUserId")); + $d->SendAdminEventMail("CATEGORY.ADD"); + } + else + { + $d->SendUserEventMail("CATEGORY.ADD.PENDING",$objSession->Get("PortalUserId")); + $d->SendAdminEventMail("CATEGORY.ADD.PENDING"); + } + $d->UpdateCachedPath(); +// RunUp($ParentId, 'Increment_Count'); + return $d; } - function &Edit_Category($CategoryId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, - $NewItem, $Pop, $Priority, $MetaKeywords,$MetaDesc) - { - $d =& $this->GetCategory($CategoryId); - $d->Set(array("Name", "Description", "CreatedOn", "EditorsPick", "Status", "HotItem", - "NewItem", "PopItem", "Priority", "MetaKeywords","MetaDescription"), - array($Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $NewItem, - $Pop, $Priority, $MetaKeywords,$MetaDesc)); - $d->Update(); - $d->UpdateCachedPath(); - return $d; + function &Edit_Category($CategoryId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, + $NewItem, $Pop, $Priority, $MetaKeywords,$MetaDesc, $auto_filename = 1, $filename = '') + { + $d =& $this->GetCategory($CategoryId); + + $filename = $d->StripDisallowed($filename); + $d->Set( Array( 'Name', 'Description', 'CreatedOn', 'EditorsPick', 'Status', 'HotItem', + 'NewItem', 'PopItem', 'Priority', 'MetaKeywords','MetaDescription', + 'AutomaticFilename', 'Filename'), + Array( $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $NewItem, + $Pop, $Priority, $MetaKeywords,$MetaDesc, $auto_filename, $filename) ); + $d->Update(); + $d->UpdateCachedPath(); + return $d; + } - } - function Move_Category($Id, $ParentTo) { global $objCatList;