forked from science-ation/science-ation
22 lines
713 B
PHP
22 lines
713 B
PHP
<?
|
|
function db_update_111_post()
|
|
{
|
|
global $config, $pdo;
|
|
// grab the index page
|
|
$q = $pdo->prepare("SELECT * FROM pagetext WHERE textname='index' AND year=?");
|
|
$q->execute([$config['FAIRYEAR']]);
|
|
if (!$q->rowCount()) {
|
|
$q = $pdo->prepare("SELECT * FROM pagetext WHERE textname='index' AND year='-1'");
|
|
$q->execute();
|
|
}
|
|
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
|
|
// insert it into the CMS under index.html
|
|
$stmt = $pdo->prepare("INSERT INTO cms (filename,dt,lang,text,showlogo) VALUES ('index.html',?,?,?,'1')");
|
|
$stmt->execute([$r->lastupdate,$r->lang,$r->text]);
|
|
}
|
|
// and remove it from the pagetext
|
|
$stmt = $pdo->prepare("DELETE FROM pagetext WHERE textname='index'");
|
|
$stmt->execute();
|
|
}
|
|
?>
|