Die Zeilen die ersetzt wurden sind mit /* auskommentiert, die Zeilen die stattdessen stehen sind mit /* + */ am Zeilenbeginn kommentiert.
Das braucht vermutlich nie jemand aber trotzdem hier der Code damit ich wenigstens auch mal etwas beitragen kann und nicht immer nur blöde Freagen habe...
Es werden folgende Artikel Eigenschaften mit kopiert: $created, $lastmodified, $author, $modifiedby, $published, $publishedby, $online,
Code: Alles auswählen
function conCopyArtLang ($srcidart, $dstidart, $newtitle)
{
global $cfg, $lang;
$db = new DB_Contenido;
$db2 = new DB_Contenido;
/* SJ $sql = "SELECT idartlang, idlang, idtplcfg, title, pagetitle, summary, */
/* SJ author, online, redirect, redirect, redirect_url, */
$sql = "SELECT idartlang, idlang, idtplcfg, title, urlname, pagetitle, summary, created, lastmodified,
author, modifiedby, published, publishedby, online, redirect, redirect_url,
artsort, timemgmt, datestart, dateend, status, free_use_01,
free_use_02, free_use_03, time_move_cat, time_target_cat,
time_online_move, external_redirect, locked FROM
".$cfg["tab"]["art_lang"]." WHERE idart = '".Contenido_Security::toInteger($srcidart)."' AND idlang='".Contenido_Security::toInteger($lang)."'";
$db->query($sql);
while ($db->next_record())
{
$nextid = $db2->nextid($cfg["tab"]["art_lang"]);
/* Copy the template configuration */
if ($db->f("idtplcfg") != 0)
{
$newidtplcfg = conCopyTemplateConfiguration($db->f("idtplcfg"));
conCopyContainerConf($db->f("idtplcfg"), $newidtplcfg);
}
conCopyContent($db->f("idartlang"), $nextid);
$idartlang = $nextid;
$idart = $dstidart;
$idlang = $db->f("idlang");
$idtplcfg = $newidtplcfg;
if ($newtitle != "")
{
$title = sprintf($newtitle, addslashes($db->f("title")));
} else {
$title = sprintf(i18n("%s (Copy)"), addslashes($db->f("title")));
}
$title = $db->f("title");
$urlname = $db->f("urlname");
$pagetitle = addslashes($db->f("pagetitle"));
$summary = addslashes($db->f("summary"));
/* - $created = date("Y-m-d H:i:s"); */
/* + */ $created = $db->f("created");
/* + */ $lastmodified = $db->f("lastmodified");
$author = $db->f("author");
/* + */ $modifiedby = $db->f("modifiedby");
/* + */ $published = $db->f("published");
/* + */ $publishedby = $db->f("publishedby");
/* - $online = 0; */
/* + */ $online = $db->f("online");
$redirect = $db->f("redirect");
$redirecturl = $db->f("redirect_url");
$artsort = $db->f("artsort");
$timemgmt = $db->f("timemgmt");
$datestart = $db->f("datestart");
$dateend = $db->f("dateend");
$status = $db->f("status");
$freeuse01 = $db->f("free_use_01");
$freeuse02 = $db->f("free_use_02");
$freeuse03 = $db->f("free_use_03");
$timemovecat = $db->f("time_move_cat");
$timetargetcat = $db->f("time_target_cat");
$timeonlinemove = $db->f("time_online_move");
$externalredirect = $db->f("external_redirect");
$locked = $db->f("locked");
$sql = "INSERT INTO ".$cfg["tab"]["art_lang"]."
(idartlang, idart, idlang, idtplcfg, title, urlname,
pagetitle, summary, created, lastmodified,
/* SJ author, online, redirect, redirect_url, */
author, modifiedby, published, publishedby, online, redirect, redirect_url,
artsort, timemgmt, datestart, dateend,
status, free_use_01, free_use_02, free_use_03,
time_move_cat, time_target_cat, time_online_move,
external_redirect, locked) VALUES ('".Contenido_Security::toInteger($idartlang)."',
'".Contenido_Security::toInteger($idart)."',
'".Contenido_Security::toInteger($idlang)."',
'".Contenido_Security::toInteger($idtplcfg)."',
'".Contenido_Security::escapeDB($title, $db2)."',
/* + */ '".Contenido_Security::escapeDB($urlname, $db2)."',
'".Contenido_Security::escapeDB($pagetitle, $db2)."',
'".Contenido_Security::escapeDB($summary, $db2)."',
'".Contenido_Security::escapeDB($created, $db2)."',
'".Contenido_Security::escapeDB($lastmodified, $d2b)."',
'".Contenido_Security::escapeDB($author, $db2)."',
/* + */ '".Contenido_Security::escapeDB($modifiedby, $db2)."',
/* + */ '".Contenido_Security::escapeDB($published, $db2)."',
/* + */ '".Contenido_Security::escapeDB($publishedby, $db2)."',
'".Contenido_Security::toInteger($online)."',
'".Contenido_Security::escapeDB($redirect, $db2)."',
'".Contenido_Security::escapeDB($redirecturl, $db2)."',
'".Contenido_Security::toInteger($artsort)."',
'".Contenido_Security::toInteger($timemgmt)."',
'".Contenido_Security::escapeDB($datestart, $db2)."',
'".Contenido_Security::escapeDB($dateend, $db2)."',
'".Contenido_Security::toInteger($status)."',
'".Contenido_Security::toInteger($freeuse01)."',
'".Contenido_Security::toInteger($freeuse02)."',
'".Contenido_Security::toInteger($freeuse03)."',
'".Contenido_Security::toInteger($timemovecat)."',
'".Contenido_Security::toInteger($timetargetcat)."',
'".Contenido_Security::toInteger($timeonlinemove)."',
'".Contenido_Security::escapeDB($externalredirect, $db)."',
'".Contenido_Security::toInteger($locked)."')";
$db2->query($sql);
// execute CEC hook
$param = CEC_Hook::execute('Contenido.Article.conCopyArtLang_AfterInsert', array(
'idartlang' => Contenido_Security::toInteger($idartlang),
'idart' => Contenido_Security::toInteger($idart),
'idlang' => Contenido_Security::toInteger($idlang),
'idtplcfg' => Contenido_Security::toInteger($idtplcfg),
'title' => Contenido_Security::escapeDB($title, $db2)
));
/* Copy meta tags */
$sql = "SELECT idmetatype, metavalue FROM ".$cfg["tab"]["meta_tag"]." WHERE idartlang = '".Contenido_Security::toInteger($db->f("idartlang"))."'";
$db->query($sql);
while ($db->next_record())
{
$nextidmetatag = $db2->nextid($cfg["tab"]["meta_tag"]);
$metatype = $db->f("idmetatype");
$metavalue = $db->f("metavalue");
$sql = "INSERT INTO ".$cfg["tab"]["meta_tag"]."
(idmetatag, idartlang, idmetatype, metavalue)
VALUES
('".Contenido_Security::toInteger($nextidmetatag)."', '".Contenido_Security::toInteger($idartlang)."', '".Contenido_Security::toInteger($metatype)."', '".Contenido_Security::escapeDB($metavalue, $db2)."')";
$db2->query($sql);
}
/* Update keyword list for new article */
conMakeArticleIndex ($idartlang, $idart);
}
}