Redirect duplicates
This commit is contained in:
parent
6c78479110
commit
0c20d35928
10
chant.php
10
chant.php
|
|
@ -15,6 +15,16 @@ if(!$c) {
|
|||
die('Wrong id');
|
||||
}
|
||||
|
||||
if($c['duplicateof'] > 0) {
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$c['duplicateof']);
|
||||
header('Connection: close');
|
||||
} elseif($c['duplicateof']) {
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: ./scores.php');
|
||||
header('Connection: close');
|
||||
}
|
||||
|
||||
$title = $c['incipit']?$c['incipit']:'░░'.$c['id'].'░░';
|
||||
$custom_header = <<<HEADER
|
||||
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
|
|
|
|||
5
feed.php
5
feed.php
|
|
@ -39,9 +39,11 @@ echo '<entry>
|
|||
';
|
||||
|
||||
while($m = $req1->fetch_assoc()) {
|
||||
$t = chant_from_id($m['chant_id']);
|
||||
if($t) {
|
||||
$user_info = get_userdata($m['user_id']);
|
||||
echo '<entry>
|
||||
<title type="html">'.chant_from_id($m['chant_id'])[1].'</title>
|
||||
<title type="html">'.$t[1].'</title>
|
||||
<link href="'.$dir.'chant.php?id='.$m['chant_id'].'" />
|
||||
<summary>'.htmlspecialchars($m['comment']).'</summary>
|
||||
<updated>'.date(DATE_ATOM,$m['time']).'</updated>
|
||||
|
|
@ -52,5 +54,6 @@ while($m = $req1->fetch_assoc()) {
|
|||
</entry>
|
||||
';
|
||||
}
|
||||
}
|
||||
echo '</feed>';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.1.0-rc2
|
||||
-- version 5.1.0
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Hôte : localhost
|
||||
-- Généré le : dim. 21 fév. 2021 à 19:10
|
||||
-- Généré le : mer. 03 mars 2021 à 21:48
|
||||
-- Version du serveur : 10.4.17-MariaDB-1:10.4.17+maria~xenial
|
||||
-- Version de PHP : 7.4.15
|
||||
|
||||
|
|
@ -67,7 +67,8 @@ CREATE TABLE `gregobase_chants` (
|
|||
`gabc_verses` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`tex_verses` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`remarks` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`copyrighted` tinyint(1) NOT NULL DEFAULT 0
|
||||
`copyrighted` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`duplicateof` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ include('include/header.php');
|
|||
echo "<h2>$title</h2>\n";
|
||||
|
||||
if($l) {
|
||||
$sql1 = 'SELECT * FROM '.db('chants').' WHERE `incipit` LIKE "'.$l.'%" ORDER BY incipit ASC';
|
||||
$sql1 = 'SELECT * FROM '.db('chants').' WHERE `duplicateof` IS NULL AND `incipit` LIKE "'.$l.'%" ORDER BY incipit ASC';
|
||||
} else {
|
||||
$sql1 = 'SELECT * FROM '.db('chants')." WHERE `incipit` LIKE '' OR UPPER(incipit) REGEXP '^[^A-Zƌ].*' ORDER BY incipit ASC";
|
||||
$sql1 = 'SELECT * FROM '.db('chants')." WHERE `duplicateof` IS NULL AND (`incipit` LIKE '' OR UPPER(incipit) REGEXP '^[^A-Zƌ].*') ORDER BY incipit ASC";
|
||||
}
|
||||
$req1 = $mysqli->query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.$mysqli->error);
|
||||
$chants = array();
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
function chant_from_id($c) {
|
||||
global $mysqli;
|
||||
$sql1 = 'SELECT `office-part`,incipit,gabc,version FROM '.db('chants').' WHERE id = '.$c;
|
||||
$sql1 = 'SELECT `office-part`,incipit,gabc,version,duplicateof FROM '.db('chants').' WHERE id = '.$c;
|
||||
$req1 = $mysqli->query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.$mysqli->error);
|
||||
$chants = array();
|
||||
$ch = $req1->fetch_assoc();
|
||||
if($ch['duplicateof']) return false;
|
||||
return array($ch['office-part'], $ch['incipit'] > ''?$ch['incipit']:'░░'.$c.'░░', $ch['gabc'] > '', $ch['version']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ $sql = 'SELECT * FROM '.db('pleasefix').' WHERE fixed = 0 ORDER BY `time`';
|
|||
$req = $mysqli->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.$mysqli->error);
|
||||
if($req->num_rows > 0) {
|
||||
while($fix = $req->fetch_assoc()) {
|
||||
echo '<h4><a href="chant.php?id='.$fix['chant_id'].'">'.format_incipit(chant_from_id($fix['chant_id'])[1])."</a></h4>\n";
|
||||
$t = chant_from_id($fix['chant_id']);
|
||||
if($t) {
|
||||
echo '<h4><a href="chant.php?id='.$fix['chant_id'].'">'.format_incipit($t[1])."</a></h4>\n";
|
||||
echo "<p><i>".nl2br(htmlspecialchars($fix['pleasefix'])).'</i> <span class="version"> (Reported on '.date("Y-m-d",$fix['time']);
|
||||
if($fix['user_id']) {
|
||||
$user_info = get_userdata($fix['user_id']);
|
||||
|
|
@ -16,6 +18,7 @@ if($req->num_rows > 0) {
|
|||
}
|
||||
echo ")</span></p>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "<p>No problem reported</p>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,12 @@ foreach($mod as $d => $ml) {
|
|||
echo $d;
|
||||
echo "<ul>\n";
|
||||
foreach($ml as $m) {
|
||||
echo '<li><a href="chant.php?id='.$m['chant_id'].'">'.format_incipit(chant_from_id($m['chant_id'])[1])."</a><br />\n";
|
||||
$t = chant_from_id($m['chant_id']);
|
||||
if($t) {
|
||||
echo '<li><a href="chant.php?id='.$m['chant_id'].'">'.format_incipit($t[1])."</a><br />\n";
|
||||
echo "<i>".htmlspecialchars($m['comment'])."</i></li>\n";
|
||||
}
|
||||
}
|
||||
echo "</ul><br />\n";
|
||||
}
|
||||
echo "</div>";
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
|
|||
$ch = $chants[$p];
|
||||
foreach($ch as $c) {
|
||||
$t = chant_from_id($c[0]);
|
||||
if($t) {
|
||||
echo '<li class="usage-marker '.$t[0].'">';
|
||||
if($t[2]) {
|
||||
echo '<a href="chant.php?id='.$c[0].'">'.format_incipit($t[1])."</a>";
|
||||
|
|
@ -61,6 +62,7 @@ if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
|
|||
echo "</li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<li class="add-chant"><a href="chant_edit.php?source='.$s.'&page='.$p.'">Add chant</a></li>'."\n";
|
||||
echo "</ul>\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -89,6 +91,7 @@ if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
|
|||
unset($chants[$p]);
|
||||
foreach($ch as $c) {
|
||||
$t = chant_from_id($c[0]);
|
||||
if($t) {
|
||||
echo '<li class="usage-marker '.$t[0].'">';
|
||||
if($t[2]) {
|
||||
echo '<a href="chant.php?id='.$c[0].'">'.format_incipit($t[1])."</a>";
|
||||
|
|
@ -97,6 +100,7 @@ if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
|
|||
}
|
||||
echo "</li>\n";
|
||||
}
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,12 @@ foreach($mod as $d => $ml) {
|
|||
echo "<h4>".$d."</h4>\n";
|
||||
echo "<ul>\n";
|
||||
foreach($ml as $m) {
|
||||
$t = chant_from_id($m['chant_id']);
|
||||
if($t) {
|
||||
$user_info = get_userdata($m['user_id']);
|
||||
echo "<li>".' <a href="chant.php?id='.$m['chant_id'].'">'.format_incipit(chant_from_id($m['chant_id'])[1])."</a><br />\n";
|
||||
echo "<i>".htmlspecialchars($m['comment']).'</i> <span class="version">('.$user_info->display_name.")</span></li>\n";
|
||||
echo "<li>".' <a href="chant.php?id='.$m['chant_id'].'">'.format_incipit($t[1])."</a><br />\n";
|
||||
echo "<i>".htmlspecialchars($m['comment']).'</i>'.($u > ''?"":' <span class="version">(<a href="'.$_SERVER['PHP_SELF'].'?user='.$m['user_id'].'">'.$user_info->display_name."</a>)</span>")."</li>\n";
|
||||
}
|
||||
}
|
||||
echo "</ul>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if(!array_key_exists($id,$txt['usage'])) {
|
|||
$title = 'Usage - '.$txt['usage'][$id];
|
||||
include('include/header.php');
|
||||
echo "<h2>$title</h2>\n";
|
||||
$sql1 = 'SELECT * FROM '.db('chants').' WHERE `office-part` = "'.$id.'" ORDER BY incipit ASC';
|
||||
$sql1 = 'SELECT * FROM '.db('chants').' WHERE `duplicateof` IS NULL AND `office-part` = "'.$id.'" ORDER BY incipit ASC';
|
||||
$req1 = $mysqli->query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.$mysqli->error);
|
||||
$chants = array();
|
||||
while($c = $req1->fetch_assoc()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue