if ($value == '') { continue; } $query = "INSERT INTO " . cms_db_prefix() . "module_news_fieldvals (news_id,fielddef_id,value,create_date,modified_date) VALUES (?,?,?,?,?)"; $dbr = $db->Execute($query, array($articleid, $fldid, $value, $now, $now)); if (!$dbr) { die('FATAL SQL ERROR: ' . $db->ErrorMsg() . '<br/>QUERY: ' . $db->sql); } } } // if if (!$error && $status == 'published' && $news_url != '') { // todo: if not expired // register the route. news_admin_ops::delete_static_route($articleid); news_admin_ops::register_static_route($news_url, $articleid); } if (!$error && $status == 'published') { //Update search index $module = cms_utils::get_search_module(); if (is_object($module)) { $text = ''; if (isset($params['customfield'])) { foreach ($params['customfield'] as $fldid => $value) { if (strlen($value) > 1) { $text .= $value . ' '; } } } $text .= $content . ' ' . $summary . ' ' . $title . ' ' . $title; $module->AddWords($this->GetName(), $articleid, 'article', $text, $useexp == 1 && $this->GetPreference('expired_searchable', 0) == 0 ? $enddate : NULL);
public function CreateStaticRoutes() { $db = cmsms()->GetDb(); $route = new CmsRoute('/[nN]ews\\/(?P<articleid>[0-9]+)\\/(?P<returnid>[0-9]+)\\/(?P<junk>.*?)\\/d,(?P<detailtemplate>.*?)$/', $this->GetName()); cms_route_manager::add_static($route); $route = new CmsRoute('/[nN]ews\\/(?P<articleid>[0-9]+)\\/(?P<returnid>[0-9]+)\\/(?P<junk>.*?)$/', $this->GetName()); cms_route_manager::add_static($route); $route = new CmsRoute('/[nN]ews\\/(?P<articleid>[0-9]+)\\/(?P<returnid>[0-9]+)$/', $this->GetName()); cms_route_manager::add_static($route); $route = new CmsRoute('/[nN]ews\\/(?P<articleid>[0-9]+)$/', $this->GetName()); cms_route_manager::add_static($route); $query = 'SELECT news_id,news_url FROM ' . cms_db_prefix() . 'module_news WHERE status = ? AND news_url != ? AND ' . '(' . $db->ifNull('start_time', $db->DbTimeStamp(1)) . ' < NOW()) AND ' . '((' . $db->IfNull('end_time', $db->DbTimeStamp(1)) . ' = ' . $db->DbTimeStamp(1) . ') OR (end_time > NOW()))'; $query .= ' ORDER BY news_date DESC'; $tmp = $db->GetArray($query, array('published', '')); if (is_array($tmp)) { foreach ($tmp as $one) { news_admin_ops::register_static_route($one['news_url'], $one['news_id']); } } }