function dynmeta_run($message) {
global $mybb, $db, $templates, $stylesheets, $headerinclude, $lang, $theme, $charset, $newpmmsg;
//meta dynamiques
$sql_kw = $db->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name='dm_keywords'");
$res_kw = $db->fetch_array($sql_kw);
$metakeywords = "<meta name=\"keywords\" content=\"".$res_kw['value']."\" />";;
$sql_ds = $db->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name='dm_defdesc'");
$res_ds = $db->fetch_array($sql_ds);
$metadescription = "<meta name=\"description\" content=\"".$res_ds['value'];
if(basename($_SERVER['PHP_SELF']) == "showthread.php" && isset($mybb->input['tid'])) {
$tid = addslashes(intval($mybb->input['tid']));
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE tid = ".$tid."");
$threaddescription = $db->fetch_array($query);
$forum = $threaddescription['fid'];
if(!empty($forum)) {
$query = $db->query("SELECT name FROM ".TABLE_PREFIX."forums WHERE fid = ".$forum."");
$forumdescription = $db->fetch_array($query);
$metadescription .= " - ".$forumdescription['name']." - ".$threaddescription['subject']."\" />";
} else {
$metadescription .= "\" />";
}
} elseif (basename($_SERVER['PHP_SELF']) == "forumdisplay.php" && isset($mybb->input['fid'])) {
$fid = addslashes(intval($mybb->input['fid']));
$query = $db->query("SELECT name FROM ".TABLE_PREFIX."forums WHERE fid = ".$fid."");
$forumdescription = $db->fetch_array($query);
if(!empty($forumdescription['name'])) {
$metadescription .= " - ".$forumdescription['name']."\" />";
} else {
$metadescription .= "\" />";
}
} else {
$metadescription .= "\" />";
}
eval("\$headerinclude = \"".$templates->get("headerinclude")."\";");
}