Init(); require_once FULL_PATH.'/admin/install/install_lib.php'; require_once FULL_PATH.'/kernel/include/tag-class.php'; if( !isset($objTagList) ) $objTagList = new clsTagList(); $ado =& GetADODBConnection(); // create module category $ml_formatter =& $application->recallObject('kMultiLanguage'); $name_field = $ml_formatter->LangFieldName('Name'); $description_field = $ml_formatter->LangFieldName('Description'); $cat =& $application->recallObject('c', null, Array('skip_autoload' => true)); $cat->Clear(); $cat_fields = Array($name_field => 'News', 'AutomaticFilename' => 1, 'Filename' => 'News', $description_field => 'News Articles', 'Status' => 1, 'ParentId' => 0, 'CategoryTemplate' => 'innews/index', 'CachedCategoryTemplate' => 'innews/index'); $cat->SetDBFieldsFromHash($cat_fields); $cat->Create(); $cat_id = $cat->GetID(); $filename = FULL_PATH.'/'.$MODULE_NAME.'/admin/install/inportal_schema.sql'; if (file_exists($filename)) RunSchemaFile($ado, $filename); $filename = FULL_PATH.'/'.$MODULE_NAME.'/admin/install/inportal_data.sql'; if (file_exists($filename)) { $sql = file($filename); for ($x = 0; $x < count($sql); $x++) { $sql[$x] = str_replace('{NewsCatId}', $cat_id, $sql[$x]); } RunSQLText($ado, $sql); $sql = 'SELECT Version FROM '.TABLE_PREFIX.'Modules WHERE Name = '.$ado->qstr('In-News'); $mod_version = $application->Conn->GetOne($sql); if (!(isset($ini_file) && $ini_file)) { $ini_file = FULL_PATH.'/config.php'; $ini_vars = inst_parse_portal_ini($ini_file, true); } set_ini_value('Module Versions', 'In-News', $mod_version); save_values(); $objTagList->ParseFile(FULL_PATH.'/'.$MODULE_NAME.'/parser.php'); } linkCustomFields($MODULE_NAME, 'n', 2); linkCustomFields('KERNEL', 'c', 1); // because in-news module creates some custom fields for categories $cat->defineFields(); $application->removeObject('c-cdata'); $cat->SetDBField('cust_n_ItemTemplate', 'innews/detail'); $cat->Update(); $sql = 'DELETE FROM '.TABLE_PREFIX.'Cache WHERE (VarName = "config_files") OR (VarName LIKE "%_parsed")'; $application->Conn->Query($sql); $objModules->Refresh(); $objModules->SetModuleRoot('In-News', $cat_id); $inp_cat =& $objCatList->GetCategory($cat_id); $inp_cat->UpdateCachedPath(); $inp_cat->UpdateACL(); finalizeModuleInstall($MODULE_NAME); ?>